Header menu logo FSharp.Data

JsonExtensions Type

Extension methods with operations on JSON values

Static members

Static member Description

JsonExtensions.AsArray(x)

Full Usage: JsonExtensions.AsArray(x)

Parameters:
Returns: JsonValue[]

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

x : JsonValue
Returns: JsonValue[]

JsonExtensions.AsBoolean(x)

Full Usage: JsonExtensions.AsBoolean(x)

Parameters:
Returns: bool

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

x : JsonValue
Returns: bool

JsonExtensions.AsDateTime(x, ?cultureInfo)

Full Usage: JsonExtensions.AsDateTime(x, ?cultureInfo)

Parameters:
Returns: DateTime

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

x : JsonValue
?cultureInfo : CultureInfo
Returns: DateTime

JsonExtensions.AsDateTimeOffset(x, ?cultureInfo)

Full Usage: JsonExtensions.AsDateTimeOffset(x, ?cultureInfo)

Parameters:
Returns: DateTimeOffset

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)

x : JsonValue
?cultureInfo : CultureInfo
Returns: DateTimeOffset

JsonExtensions.AsDecimal(x, ?cultureInfo)

Full Usage: JsonExtensions.AsDecimal(x, ?cultureInfo)

Parameters:
Returns: decimal

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

x : JsonValue
?cultureInfo : CultureInfo
Returns: decimal

JsonExtensions.AsFloat(x, ?cultureInfo, ?missingValues)

Full Usage: JsonExtensions.AsFloat(x, ?cultureInfo, ?missingValues)

Parameters:
Returns: float

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

x : JsonValue
?cultureInfo : CultureInfo
?missingValues : string[]
Returns: float

JsonExtensions.AsGuid(x)

Full Usage: JsonExtensions.AsGuid(x)

Parameters:
Returns: Guid

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

x : JsonValue
Returns: Guid

JsonExtensions.AsInteger(x, ?cultureInfo)

Full Usage: JsonExtensions.AsInteger(x, ?cultureInfo)

Parameters:
Returns: int

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

x : JsonValue
?cultureInfo : CultureInfo
Returns: int

JsonExtensions.AsInteger64(x, ?cultureInfo)

Full Usage: JsonExtensions.AsInteger64(x, ?cultureInfo)

Parameters:
Returns: int64

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

x : JsonValue
?cultureInfo : CultureInfo
Returns: int64

JsonExtensions.AsString(x, ?cultureInfo)

Full Usage: JsonExtensions.AsString(x, ?cultureInfo)

Parameters:
Returns: string

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

x : JsonValue
?cultureInfo : CultureInfo
Returns: string

JsonExtensions.AsTimeSpan(x, ?cultureInfo)

Full Usage: JsonExtensions.AsTimeSpan(x, ?cultureInfo)

Parameters:
Returns: TimeSpan

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

x : JsonValue
?cultureInfo : CultureInfo
Returns: TimeSpan

JsonExtensions.GetEnumerator(x)

Full Usage: JsonExtensions.GetEnumerator(x)

Parameters:
Returns: IEnumerator
Modifiers: inline

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

x : JsonValue
Returns: IEnumerator

JsonExtensions.GetProperty(x, propertyName)

Full Usage: JsonExtensions.GetProperty(x, propertyName)

Parameters:
Returns: JsonValue

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

x : JsonValue
propertyName : string
Returns: JsonValue

JsonExtensions.InnerText(x)

Full Usage: JsonExtensions.InnerText(x)

Parameters:
Returns: string

Get inner text of an element

x : JsonValue
Returns: string

JsonExtensions.Item(x, index)

Full Usage: JsonExtensions.Item(x, index)

Parameters:
Returns: JsonValue
Modifiers: inline

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

x : JsonValue
index : int
Returns: JsonValue

JsonExtensions.Item(x, propertyName)

Full Usage: JsonExtensions.Item(x, propertyName)

Parameters:
Returns: JsonValue
Modifiers: inline

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

x : JsonValue
propertyName : string
Returns: JsonValue

JsonExtensions.Properties(x)

Full Usage: JsonExtensions.Properties(x)

Parameters:
Returns: (string * JsonValue)[]

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

x : JsonValue
Returns: (string * JsonValue)[]

JsonExtensions.TryGetProperty(x, propertyName)

Full Usage: JsonExtensions.TryGetProperty(x, propertyName)

Parameters:
Returns: 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.

x : JsonValue
propertyName : string
Returns: JsonValue option

Type something to start searching.