F# Data


JsonRuntime

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

Static members

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

Converts JSON array to array of target types

ConvertBoolean(cultureStr, json)
Signature: (cultureStr:string * json:JsonValue option) -> bool option
ConvertDateTime(cultureStr, json)
Signature: (cultureStr:string * json:JsonValue option) -> DateTime option
ConvertDecimal(cultureStr, json)
Signature: (cultureStr:string * json:JsonValue option) -> decimal option
ConvertFloat(...)
Signature: (cultureStr:string * missingValuesStr:string * json:JsonValue option) -> float option
ConvertGuid(json)
Signature: (json:JsonValue option) -> Guid option
ConvertInteger(cultureStr, json)
Signature: (cultureStr:string * json:JsonValue option) -> int option
ConvertInteger64(cultureStr, json)
Signature: (cultureStr:string * json:JsonValue option) -> int64 option
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

ConvertString(cultureStr, json)
Signature: (cultureStr:string * json:JsonValue option) -> string option
CreateArray(elements, cultureStr)
Signature: (elements:obj [] * cultureStr:string) -> IJsonDocument
CreateRecord(properties, cultureStr)
Signature: (properties:(string * obj) [] * cultureStr:string) -> IJsonDocument
CreateValue(value, cultureStr)
Signature: (value:obj * cultureStr:string) -> IJsonDocument
GetArrayChildByTypeTag(...)
Signature: (doc:IJsonDocument * cultureStr:string * tagCode:string) -> IJsonDocument

Returns a single array children that matches the specified tag

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

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

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

Get json property and wrap in json document

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

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

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

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

Get optional json property wrapped in json document

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

Get optional json property

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

Get optional json property and wrap it together with path

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