F# Data


JsonExtensions

Namespace: FSharp.Data

Extension methods with operations on JSON values

Static members

Static memberDescription
AsArray(x)
Signature: x:JsonValue -> JsonValue []

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

AsBoolean(x)
Signature: x:JsonValue -> bool

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

AsDateTime(x, cultureInfo)
Signature: (x:JsonValue * cultureInfo:CultureInfo option) -> DateTime

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

AsDecimal(x, cultureInfo)
Signature: (x:JsonValue * cultureInfo:CultureInfo option) -> decimal

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

AsFloat(x, cultureInfo, missingValues)
Signature: (x:JsonValue * cultureInfo:CultureInfo option * missingValues:string [] option) -> float

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

AsGuid(x)
Signature: x:JsonValue -> Guid

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

AsInteger(x, cultureInfo)
Signature: (x:JsonValue * cultureInfo:CultureInfo option) -> int

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

AsInteger64(x, cultureInfo)
Signature: (x:JsonValue * cultureInfo:CultureInfo option) -> int64

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

AsString(x, cultureInfo)
Signature: (x:JsonValue * cultureInfo:CultureInfo option) -> string

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

GetEnumerator(x)
Signature: x:JsonValue -> IEnumerator

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

GetProperty(x, propertyName)
Signature: (x:JsonValue * propertyName:string) -> JsonValue

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

InnerText(x)
Signature: x:JsonValue -> string

Get inner text of an element

Item(x, index)
Signature: (x:JsonValue * index:int) -> JsonValue

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

Item(x, propertyName)
Signature: (x:JsonValue * propertyName:string) -> JsonValue

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

Properties(x)
Signature: x:JsonValue -> (string * JsonValue) []

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

TryGetProperty(x, propertyName)
Signature: (x:JsonValue * propertyName:string) -> JsonValue option

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