F# Data


JsonExtensions

Namespace: FSharp.Data
Attributes:
[<Extension>]

Extension methods with operations on JSON values

Static members

Static memberDescription
JsonExtensions.AsArray(x)
Signature: x:JsonValue -> JsonValue []
Attributes:
[<Extension>]

Get all the elements of a JSON value. Returns an empty array if the value is not a JSON array.

JsonExtensions.AsBoolean(x)
Signature: x:JsonValue -> bool
Attributes:
[<Extension>]

Get the boolean value of an element (assuming that the value is a boolean)

JsonExtensions.AsDateTime(...)
Signature: (x:JsonValue * cultureInfo:CultureInfo option) -> DateTime
Attributes:
[<Extension>]

Get the datetime value of an element (assuming that the value is a string containing well-formed ISO date or MSFT JSON date)

JsonExtensions.AsDateTimeOffset(...)
Signature: (x:JsonValue * cultureInfo:CultureInfo option) -> DateTimeOffset
Attributes:
[<Extension>]

Get the datetime offset value of an element (assuming that the value is a string containing well-formed ISO date time with offset or MSFT JSON datetime with offset)

JsonExtensions.AsDecimal(x, cultureInfo)
Signature: (x:JsonValue * cultureInfo:CultureInfo option) -> decimal
Attributes:
[<Extension>]

Get a number as a decimal (assuming that the value fits in decimal)

JsonExtensions.AsFloat(...)
Signature: (x:JsonValue * cultureInfo:CultureInfo option * missingValues:string [] option) -> float
Attributes:
[<Extension>]

Get a number as a float (assuming that the value is convertible to a float)

JsonExtensions.AsGuid(x)
Signature: x:JsonValue -> Guid
Attributes:
[<Extension>]

Get the guid value of an element (assuming that the value is a guid)

JsonExtensions.AsInteger(x, cultureInfo)
Signature: (x:JsonValue * cultureInfo:CultureInfo option) -> int
Attributes:
[<Extension>]

Get a number as an integer (assuming that the value fits in integer)

JsonExtensions.AsInteger64(...)
Signature: (x:JsonValue * cultureInfo:CultureInfo option) -> int64
Attributes:
[<Extension>]

Get a number as a 64-bit integer (assuming that the value fits in 64-bit integer)

JsonExtensions.AsString(x, cultureInfo)
Signature: (x:JsonValue * cultureInfo:CultureInfo option) -> string
Attributes:
[<Extension>]

Get the string value of an element (assuming that the value is a scalar) Returns the empty string for JsonValue.Null

JsonExtensions.AsTimeSpan(...)
Signature: (x:JsonValue * cultureInfo:CultureInfo option) -> TimeSpan
Attributes:
[<Extension>]

Get the timespan value of an element (assuming that the value is a string containing well-formed time span)

JsonExtensions.GetEnumerator(x)
Signature: x:JsonValue -> IEnumerator
Attributes:
[<Extension>]

Get all the elements of a JSON value (assuming that the value is an array)

JsonExtensions.GetProperty(...)
Signature: (x:JsonValue * propertyName:string) -> JsonValue
Attributes:
[<Extension>]

Get property of a JSON object. Fails if the value is not an object or if the property is not present

JsonExtensions.InnerText(x)
Signature: x:JsonValue -> string
Attributes:
[<Extension>]

Get inner text of an element

JsonExtensions.Item(x, index)
Signature: (x:JsonValue * index:int) -> JsonValue
Attributes:
[<Extension>]

Try to get the value at the specified index, if the value is a JSON array.

JsonExtensions.Item(x, propertyName)
Signature: (x:JsonValue * propertyName:string) -> JsonValue
Attributes:
[<Extension>]

Assuming the value is an object, get value with the specified name

JsonExtensions.Properties(x)
Signature: x:JsonValue -> (string * JsonValue) []
Attributes:
[<Extension>]

Get a sequence of key-value pairs representing the properties of an object

JsonExtensions.TryGetProperty(...)
Signature: (x:JsonValue * propertyName:string) -> JsonValue option
Attributes:
[<Extension>]

Try to get a property of a JSON value. Returns None if the value is not an object or if the property is not present.

Fork me on GitHub