Json

Namespace: Saon.Json
Attributes:
[<RequireQualifiedAccess>]

Functions and values

Function or valueDescription
Json.bool propName element
Signature: propName:string -> element:(type) -> ParserResult<bool>

Get the element bool value.

Json.createDocumentParser(parser)
Signature: parser:((type) -> ParserResult<'T>) -> (type) -> ParserResult<'T>
Type parameters: 'T

Create a parser to parse JsonDocuments.

Json.embeddedObject inner element
Signature: inner:((type) -> ParserResult<'T>) -> element:(type) -> ParserResult<'T> * (type)
Type parameters: 'T

Parse part of the current element as a JSON object using the inner parser.

Json.int64 propName element
Signature: propName:string -> element:(type) -> ParserResult<int64>

Get the element int64 value.

Json.list inner propName element
Signature: inner:Transformer<(type),'T> -> propName:string -> element:(type) -> ParserResult<'T list>
Type parameters: 'T

Apply the inner parser to each children of the json array element.

Json.object inner propName element
Signature: inner:((type) -> ParserResult<'T>) -> propName:string -> element:(type) -> ParserResult<'T>
Type parameters: 'T

Parse the element as a JSON object using the inner parser.

Json.oneOf matchers element
Signature: matchers:(string * Transformer<(type),'T>) list -> element:(type) -> ParserResult<'T> * (type)
Type parameters: 'T

Matches the first of properties it finds, applying the transformer to it.

Json.onlyOneOf matchers element
Signature: matchers:(string * Transformer<(type),'T>) list -> element:(type) -> ParserResult<'T> * (type)
Type parameters: 'T

Matches only one of the properties, applying the transformer to it. Returns a ValidationError if more than one property matches.

Json.optionalProperty(...)
Signature: propName:string -> func:Transformer<(type),'T> -> element:(type) -> ParserResult<'T option> * (type)
Type parameters: 'T

Apply the transformation func to the element optional property propName.

Json.property propName func element
Signature: propName:string -> func:Transformer<(type),'T> -> element:(type) -> ParserResult<'T> * (type)
Type parameters: 'T

Apply the transformation func to the element property propName.

Json.string propName element
Signature: propName:string -> element:(type) -> ParserResult<string>

Get the element string value.