Header menu logo FSharp.Data

JsonRuntime Type

Static helper methods called from the generated code for working with JSON

Static members

Static member Description

JsonRuntime.ConvertArray(doc, mapping)

Full Usage: JsonRuntime.ConvertArray(doc, mapping)

Parameters:
Returns: 'T[]

Converts JSON array to array of target types

doc : IJsonDocument
mapping : Func<IJsonDocument, 'T>
Returns: 'T[]

JsonRuntime.ConvertBoolean(json)

Full Usage: JsonRuntime.ConvertBoolean(json)

Parameters:
Returns: bool option
json : JsonValue option
Returns: bool option

JsonRuntime.ConvertDateTime(cultureStr, json)

Full Usage: JsonRuntime.ConvertDateTime(cultureStr, json)

Parameters:
    cultureStr : string
    json : JsonValue option

Returns: DateTime option
cultureStr : string
json : JsonValue option
Returns: DateTime option

JsonRuntime.ConvertDateTimeOffset(cultureStr, json)

Full Usage: JsonRuntime.ConvertDateTimeOffset(cultureStr, json)

Parameters:
    cultureStr : string
    json : JsonValue option

Returns: DateTimeOffset option
cultureStr : string
json : JsonValue option
Returns: DateTimeOffset option

JsonRuntime.ConvertDecimal(cultureStr, json)

Full Usage: JsonRuntime.ConvertDecimal(cultureStr, json)

Parameters:
    cultureStr : string
    json : JsonValue option

Returns: decimal option
cultureStr : string
json : JsonValue option
Returns: decimal option

JsonRuntime.ConvertFloat(cultureStr, missingValuesStr, json)

Full Usage: JsonRuntime.ConvertFloat(cultureStr, missingValuesStr, json)

Parameters:
    cultureStr : string
    missingValuesStr : string
    json : JsonValue option

Returns: float option
cultureStr : string
missingValuesStr : string
json : JsonValue option
Returns: float option

JsonRuntime.ConvertGuid(json)

Full Usage: JsonRuntime.ConvertGuid(json)

Parameters:
Returns: Guid option
json : JsonValue option
Returns: Guid option

JsonRuntime.ConvertInteger(cultureStr, json)

Full Usage: JsonRuntime.ConvertInteger(cultureStr, json)

Parameters:
    cultureStr : string
    json : JsonValue option

Returns: int option
cultureStr : string
json : JsonValue option
Returns: int option

JsonRuntime.ConvertInteger64(cultureStr, json)

Full Usage: JsonRuntime.ConvertInteger64(cultureStr, json)

Parameters:
    cultureStr : string
    json : JsonValue option

Returns: int64 option
cultureStr : string
json : JsonValue option
Returns: int64 option

JsonRuntime.ConvertOptionalProperty(doc, name, mapping)

Full Usage: JsonRuntime.ConvertOptionalProperty(doc, name, mapping)

Parameters:
Returns: 'T option

Get optional json property and convert to a specified type

doc : IJsonDocument
name : string
mapping : Func<IJsonDocument, 'T>
Returns: 'T option

JsonRuntime.ConvertRecordToDictionary(doc, mappingKey, mappingValue)

Full Usage: JsonRuntime.ConvertRecordToDictionary(doc, mappingKey, mappingValue)

Parameters:
Returns: ('Key * 'Value) seq

Converts JSON record to dictionary

doc : IJsonDocument
mappingKey : Func<IJsonDocument, 'Key>
mappingValue : Func<IJsonDocument, 'Value>
Returns: ('Key * 'Value) seq

JsonRuntime.ConvertString(cultureStr, json)

Full Usage: JsonRuntime.ConvertString(cultureStr, json)

Parameters:
    cultureStr : string
    json : JsonValue option

Returns: string option
cultureStr : string
json : JsonValue option
Returns: string option

JsonRuntime.ConvertTimeSpan(cultureStr, json)

Full Usage: JsonRuntime.ConvertTimeSpan(cultureStr, json)

Parameters:
    cultureStr : string
    json : JsonValue option

Returns: TimeSpan option
cultureStr : string
json : JsonValue option
Returns: TimeSpan option

JsonRuntime.CreateArray(elements, cultureStr)

Full Usage: JsonRuntime.CreateArray(elements, cultureStr)

Parameters:
    elements : obj[]
    cultureStr : string

Returns: IJsonDocument

Creates a scalar JsonValue.Array and wraps it in a json document

elements : obj[]
cultureStr : string
Returns: IJsonDocument

JsonRuntime.CreateRecord(properties, cultureStr)

Full Usage: JsonRuntime.CreateRecord(properties, cultureStr)

Parameters:
    properties : (string * obj)[]
    cultureStr : string

Returns: IJsonDocument
properties : (string * obj)[]
cultureStr : string
Returns: IJsonDocument

JsonRuntime.CreateRecordFromDictionary(keyValuePairs, cultureStr, mappingKeyBack)

Full Usage: JsonRuntime.CreateRecordFromDictionary(keyValuePairs, cultureStr, mappingKeyBack)

Parameters:
    keyValuePairs : ('Key * 'Value) seq
    cultureStr : string
    mappingKeyBack : Func<'Key, string>

Returns: IJsonDocument
keyValuePairs : ('Key * 'Value) seq
cultureStr : string
mappingKeyBack : Func<'Key, string>
Returns: IJsonDocument

JsonRuntime.CreateValue(value, cultureStr)

Full Usage: JsonRuntime.CreateValue(value, cultureStr)

Parameters:
    value : obj
    cultureStr : string

Returns: IJsonDocument

Creates a scalar JsonValue and wraps it in a json document

value : obj
cultureStr : string
Returns: IJsonDocument

JsonRuntime.GetArrayChildByTypeTag(doc, cultureStr, tagCode)

Full Usage: JsonRuntime.GetArrayChildByTypeTag(doc, cultureStr, tagCode)

Parameters:
Returns: IJsonDocument

Returns a single array children that matches the specified tag

doc : IJsonDocument
cultureStr : string
tagCode : string
Returns: IJsonDocument

JsonRuntime.GetArrayChildrenByTypeTag(doc, cultureStr, tagCode, mapping)

Full Usage: JsonRuntime.GetArrayChildrenByTypeTag(doc, cultureStr, tagCode, mapping)

Parameters:
Returns: 'T[]

Returns all array values that match the specified tag

doc : IJsonDocument
cultureStr : string
tagCode : string
mapping : Func<IJsonDocument, 'T>
Returns: 'T[]

JsonRuntime.GetKeysFromInferedDictionary(doc, mappingKey)

Full Usage: JsonRuntime.GetKeysFromInferedDictionary(doc, mappingKey)

Parameters:
Returns: 'Key[]

Get keys from infered dictionary

doc : IJsonDocument
mappingKey : Func<IJsonDocument, 'Key>
Returns: 'Key[]

JsonRuntime.GetNonOptionalValue(path, opt, originalValue)

Full Usage: JsonRuntime.GetNonOptionalValue(path, opt, originalValue)

Parameters:
    path : string
    opt : 'T option
    originalValue : JsonValue option

Returns: 'T

Operation that extracts the value from an option and reports a meaningful error message when the value is not there If the originalValue is a scalar, for missing strings we return "", and for missing doubles we return NaN For other types an error is thrown

path : string
opt : 'T option
originalValue : JsonValue option
Returns: 'T

JsonRuntime.GetPropertyPacked(doc, name)

Full Usage: JsonRuntime.GetPropertyPacked(doc, name)

Parameters:
Returns: IJsonDocument

Get json property and wrap in json document

doc : IJsonDocument
name : string
Returns: IJsonDocument

JsonRuntime.GetPropertyPackedOrNull(doc, name)

Full Usage: JsonRuntime.GetPropertyPackedOrNull(doc, name)

Parameters:
Returns: IJsonDocument

Get json property and wrap in json document, and return null if not found

doc : IJsonDocument
name : string
Returns: IJsonDocument

JsonRuntime.GetRecordProperties(doc)

Full Usage: JsonRuntime.GetRecordProperties(doc)

Parameters:
Returns: (string * JsonValue)[]

Get properties of the record

doc : IJsonDocument
Returns: (string * JsonValue)[]

JsonRuntime.GetValueByKeyFromInferedDictionary(doc, mappingKey, mappingValue, key)

Full Usage: JsonRuntime.GetValueByKeyFromInferedDictionary(doc, mappingKey, mappingValue, key)

Parameters:
Returns: 'Value

Get a value by the key from infered dictionary

doc : IJsonDocument
mappingKey : Func<IJsonDocument, 'Key>
mappingValue : Func<IJsonDocument, 'Value>
key : 'Key
Returns: 'Value

JsonRuntime.GetValuesFromInferedDictionary(doc, mappingValue)

Full Usage: JsonRuntime.GetValuesFromInferedDictionary(doc, mappingValue)

Parameters:
Returns: 'Value[]

Get values from infered dictionary

doc : IJsonDocument
mappingValue : Func<IJsonDocument, 'Value>
Returns: 'Value[]

JsonRuntime.InferedDictionaryContainsKey(doc, mappingKey, key)

Full Usage: JsonRuntime.InferedDictionaryContainsKey(doc, mappingKey, key)

Parameters:
Returns: bool

Get a value by the key from infered dictionary

doc : IJsonDocument
mappingKey : Func<IJsonDocument, 'Key>
key : 'Key
Returns: bool

JsonRuntime.TryGetArrayChildByTypeTag(doc, cultureStr, tagCode, mapping)

Full Usage: JsonRuntime.TryGetArrayChildByTypeTag(doc, cultureStr, tagCode, mapping)

Parameters:
Returns: 'T option

Returns single or no value from an array matching the specified tag

doc : IJsonDocument
cultureStr : string
tagCode : string
mapping : Func<IJsonDocument, 'T>
Returns: 'T option

JsonRuntime.TryGetPropertyPacked(doc, name)

Full Usage: JsonRuntime.TryGetPropertyPacked(doc, name)

Parameters:
Returns: IJsonDocument option

Get optional json property wrapped in json document

doc : IJsonDocument
name : string
Returns: IJsonDocument option

JsonRuntime.TryGetPropertyUnpacked(doc, name)

Full Usage: JsonRuntime.TryGetPropertyUnpacked(doc, name)

Parameters:
Returns: JsonValue option

Get optional json property

doc : IJsonDocument
name : string
Returns: JsonValue option

JsonRuntime.TryGetPropertyUnpackedWithPath(doc, name)

Full Usage: JsonRuntime.TryGetPropertyUnpackedWithPath(doc, name)

Parameters:
Returns: JsonValueOptionAndPath

Get optional json property and wrap it together with path

doc : IJsonDocument
name : string
Returns: JsonValueOptionAndPath

JsonRuntime.TryGetValueByKeyFromInferedDictionary(doc, mappingKey, mappingValue, key)

Full Usage: JsonRuntime.TryGetValueByKeyFromInferedDictionary(doc, mappingKey, mappingValue, key)

Parameters:
Returns: 'Value option

Try get a value by the key from infered dictionary

doc : IJsonDocument
mappingKey : Func<IJsonDocument, 'Key>
mappingValue : Func<IJsonDocument, 'Value>
key : 'Key
Returns: 'Value option

JsonRuntime.TryGetValueByTypeTag(doc, cultureStr, tagCode, mapping)

Full Usage: JsonRuntime.TryGetValueByTypeTag(doc, cultureStr, tagCode, mapping)

Parameters:
Returns: 'T option

Returns a single or no value by tag type

doc : IJsonDocument
cultureStr : string
tagCode : string
mapping : Func<IJsonDocument, 'T>
Returns: 'T option

Type something to start searching.