F# Data


JsonRuntime

Namespace: FSharp.Data.Runtime

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

Static members

Static memberDescription
JsonRuntime.ConvertArray(doc, mapping)
Signature: (doc:IJsonDocument * mapping:Func<IJsonDocument,'T>) -> 'T []
Type parameters: 'T

Converts JSON array to array of target types

JsonRuntime.ConvertBoolean(json)
Signature: (json:JsonValue option) -> bool option
JsonRuntime.ConvertDateTime(...)
Signature: (cultureStr:string * json:JsonValue option) -> DateTime option
JsonRuntime.ConvertDateTimeOffset(...)
Signature: (cultureStr:string * json:JsonValue option) -> DateTimeOffset option
JsonRuntime.ConvertDecimal(...)
Signature: (cultureStr:string * json:JsonValue option) -> decimal option
JsonRuntime.ConvertFloat(...)
Signature: (cultureStr:string * missingValuesStr:string * json:JsonValue option) -> float option
JsonRuntime.ConvertGuid(json)
Signature: (json:JsonValue option) -> Guid option
JsonRuntime.ConvertInteger(...)
Signature: (cultureStr:string * json:JsonValue option) -> int option
JsonRuntime.ConvertInteger64(...)
Signature: (cultureStr:string * json:JsonValue option) -> int64 option
JsonRuntime.ConvertOptionalProperty(...)
Signature: (doc:IJsonDocument * name:string * mapping:Func<IJsonDocument,'T>) -> 'T option
Type parameters: 'T

Get optional json property and convert to a specified type

JsonRuntime.ConvertString(...)
Signature: (cultureStr:string * json:JsonValue option) -> string option
JsonRuntime.ConvertTimeSpan(...)
Signature: (cultureStr:string * json:JsonValue option) -> TimeSpan option
JsonRuntime.CreateArray(...)
Signature: (elements:obj [] * cultureStr:string) -> IJsonDocument

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

JsonRuntime.CreateRecord(...)
Signature: (properties:(string * obj) [] * cultureStr:string) -> IJsonDocument
JsonRuntime.CreateValue(...)
Signature: (value:obj * cultureStr:string) -> IJsonDocument

Creates a scalar JsonValue and wraps it in a json document

JsonRuntime.GetArrayChildByTypeTag(...)
Signature: (doc:IJsonDocument * cultureStr:string * tagCode:string) -> IJsonDocument

Returns a single array children that matches the specified tag

JsonRuntime.GetArrayChildrenByTypeTag(...)
Signature: (doc:IJsonDocument * cultureStr:string * tagCode:string * mapping:Func<IJsonDocument,'T>) -> 'T []
Type parameters: 'T

Returns all array values that match the specified tag

JsonRuntime.GetNonOptionalValue(...)
Signature: (path:string * opt:'T option * originalValue:JsonValue option) -> 'T
Type parameters: '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

JsonRuntime.GetPropertyPacked(doc, name)
Signature: (doc:IJsonDocument * name:string) -> IJsonDocument

Get json property and wrap in json document

JsonRuntime.GetPropertyPackedOrNull(...)
Signature: (doc:IJsonDocument * name:string) -> IJsonDocument

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

JsonRuntime.TryGetArrayChildByTypeTag(...)
Signature: (doc:IJsonDocument * cultureStr:string * tagCode:string * mapping:Func<IJsonDocument,'T>) -> 'T option
Type parameters: 'T

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

JsonRuntime.TryGetPropertyPacked(...)
Signature: (doc:IJsonDocument * name:string) -> IJsonDocument option

Get optional json property wrapped in json document

JsonRuntime.TryGetPropertyUnpacked(...)
Signature: (doc:IJsonDocument * name:string) -> JsonValue option

Get optional json property

JsonRuntime.TryGetPropertyUnpackedWithPath(...)
Signature: (doc:IJsonDocument * name:string) -> JsonValueOptionAndPath

Get optional json property and wrap it together with path

JsonRuntime.TryGetValueByTypeTag(...)
Signature: (doc:IJsonDocument * cultureStr:string * tagCode:string * mapping:Func<IJsonDocument,'T>) -> 'T option
Type parameters: 'T

Returns a single or no value by tag type

Fork me on GitHub