Header menu logo FSharp.Data

JsonValue Type

Represents a JSON value. Large numbers that do not fit in the Decimal type are represented using the Float case, while smaller numbers are represented as decimals to avoid precision loss.

Union cases

Union case Description

Array elements

Full Usage: Array elements

Parameters:

A JSON array of values

elements : JsonValue[]

Boolean bool

Full Usage: Boolean bool

Parameters:
    Item : bool

A JSON boolean value

Item : bool

Float float

Full Usage: Float float

Parameters:
    Item : float

A JSON number stored as a float (used for large numbers that do not fit in decimal)

Item : float

Null

Full Usage: Null

A JSON null value

Number decimal

Full Usage: Number decimal

Parameters:
    Item : decimal

A JSON number stored as a decimal (used for numbers that fit in the decimal range)

Item : decimal

Record properties

Full Usage: Record properties

Parameters:

A JSON object, represented as an array of name-value pairs

properties : (string * JsonValue)[]

String string

Full Usage: String string

Parameters:
    Item : string

A JSON string value

Item : string

Instance members

Instance member Description

this.Request

Full Usage: this.Request

Parameters:
    url : string - The URL to send the JSON to.
    ?httpMethod : string - The HTTP method to use (default: POST).
    ?headers : (string * string) seq - Additional HTTP headers to include.

Returns: HttpResponse An HttpResponse containing the server's response.

Sends the JSON to the specified URL synchronously. Defaults to a POST request.

url : string

The URL to send the JSON to.

?httpMethod : string

The HTTP method to use (default: POST).

?headers : (string * string) seq

Additional HTTP headers to include.

Returns: HttpResponse

An HttpResponse containing the server's response.

this.RequestAsync

Full Usage: this.RequestAsync

Parameters:
    url : string - The URL to send the JSON to.
    ?httpMethod : string - The HTTP method to use (default: POST).
    ?headers : (string * string) seq - Additional HTTP headers to include.

Returns: Async<HttpResponse> An async computation yielding an HttpResponse containing the server's response.

Sends the JSON to the specified URL asynchronously. Defaults to a POST request.

url : string

The URL to send the JSON to.

?httpMethod : string

The HTTP method to use (default: POST).

?headers : (string * string) seq

Additional HTTP headers to include.

Returns: Async<HttpResponse>

An async computation yielding an HttpResponse containing the server's response.

this.ToString

Full Usage: this.ToString

Parameters:
    ?indentationSpaces : int - Number of spaces per indentation level (default 2).

Returns: string The formatted JSON string representation.

Serializes this JsonValue to a formatted (indented) string.

?indentationSpaces : int

Number of spaces per indentation level (default 2).

Returns: string

The formatted JSON string representation.

this.ToString

Full Usage: this.ToString

Parameters:
    saveOptions : JsonSaveOptions - Controls formatting: indented, compact, or compact with spaces.
    ?indentationSpaces : int - Number of spaces per indentation level (default 2). Only used when saveOptions is None.

Returns: string The JSON string representation.

Serializes this JsonValue to a string with the specified formatting options.

saveOptions : JsonSaveOptions

Controls formatting: indented, compact, or compact with spaces.

?indentationSpaces : int

Number of spaces per indentation level (default 2). Only used when saveOptions is None.

Returns: string

The JSON string representation.

this.WriteTo

Full Usage: this.WriteTo

Parameters:
    w : TextWriter - The writer to serialize to.
    saveOptions : JsonSaveOptions - Controls formatting: indented, compact, or compact with spaces.
    ?indentationSpaces : int - Number of spaces per indentation level (default 2). Only used when saveOptions is None.

Serializes the JsonValue to the specified System.IO.TextWriter.

w : TextWriter

The writer to serialize to.

saveOptions : JsonSaveOptions

Controls formatting: indented, compact, or compact with spaces.

?indentationSpaces : int

Number of spaces per indentation level (default 2). Only used when saveOptions is None.

Static members

Static member Description

JsonValue.AsyncLoad(uri, ?encoding)

Full Usage: JsonValue.AsyncLoad(uri, ?encoding)

Parameters:
    uri : string - The URI to load JSON from (file path or URL).
    ?encoding : Encoding - The text encoding to use (default: UTF-8).

Returns: Async<JsonValue> An async computation yielding a JsonValue representing the parsed JSON.

Loads JSON from the specified URI asynchronously.

uri : string

The URI to load JSON from (file path or URL).

?encoding : Encoding

The text encoding to use (default: UTF-8).

Returns: Async<JsonValue>

An async computation yielding a JsonValue representing the parsed JSON.

JsonValue.Load(uri, ?encoding)

Full Usage: JsonValue.Load(uri, ?encoding)

Parameters:
    uri : string - The URI to load JSON from (file path or URL).
    ?encoding : Encoding - The text encoding to use (default: UTF-8).

Returns: JsonValue A JsonValue representing the parsed JSON.

Loads JSON from the specified URI.

uri : string

The URI to load JSON from (file path or URL).

?encoding : Encoding

The text encoding to use (default: UTF-8).

Returns: JsonValue

A JsonValue representing the parsed JSON.

JsonValue.Load(reader)

Full Usage: JsonValue.Load(reader)

Parameters:
    reader : TextReader - The text reader to read JSON from.

Returns: JsonValue A JsonValue representing the parsed JSON.

Loads JSON from the specified reader.

reader : TextReader

The text reader to read JSON from.

Returns: JsonValue

A JsonValue representing the parsed JSON.

JsonValue.Load(stream)

Full Usage: JsonValue.Load(stream)

Parameters:
    stream : Stream - The stream to read JSON from.

Returns: JsonValue A JsonValue representing the parsed JSON.

Loads JSON from the specified stream.

stream : Stream

The stream to read JSON from.

Returns: JsonValue

A JsonValue representing the parsed JSON.

JsonValue.Parse(text)

Full Usage: JsonValue.Parse(text)

Parameters:
    text : string - The JSON string to parse.

Returns: JsonValue A JsonValue representing the parsed JSON.

Parses the specified JSON string.

text : string

The JSON string to parse.

Returns: JsonValue

A JsonValue representing the parsed JSON.

JsonValue.ParseMultiple(text)

Full Usage: JsonValue.ParseMultiple(text)

Parameters:
    text : string - The string containing multiple JSON values.

Returns: JsonValue seq A sequence of JsonValue instances.

Parses the specified string into multiple JSON values (e.g. newline-delimited JSON).

text : string

The string containing multiple JSON values.

Returns: JsonValue seq

A sequence of JsonValue instances.

JsonValue.TryParse(text)

Full Usage: JsonValue.TryParse(text)

Parameters:
    text : string - The JSON string to parse.

Returns: JsonValue option Some JsonValue if parsing succeeds, or None if parsing fails.

Attempts to parse the specified JSON string.

text : string

The JSON string to parse.

Returns: JsonValue option

Some JsonValue if parsing succeeds, or None if parsing fails.

Type something to start searching.