Saxon.Api

 

 

Saxon.Api

Class JsonBuilder


public class JsonBuilder

A JsonBuilder allows XDM values (typically maps and arrays) to be constructed by parsing JSON input

Property Summary

 bool Liberal

Specify whether parsing is to be strict or liberal. The default is strict, in which case input must conform strictly to the JSON specification. If the Liberal option is set, certain departures from JSON syntax are permitted (and ignored), for example an extra comma is allowed after the entries in an array or object.

 

Method Summary

 XdmValue ParseJson (TextReader jsonReader)

Parse a JSON document supplied using a TextReader

 XdmValue parseJson (TextReader jsonReader)

Obsolete synonym of ParseJson.

 XdmValue ParseJson (string json)

Parse a JSON document supplied as a string

 XdmValue parseJson (string json)

Obsolete synonym of ParseJson

 

Property Detail

Liberal

public bool Liberal {get; set; }

Specify whether parsing is to be strict or liberal. The default is strict, in which case input must conform strictly to the JSON specification. If the Liberal option is set, certain departures from JSON syntax are permitted (and ignored), for example an extra comma is allowed after the entries in an array or object.

Method Detail

ParseJson

public XdmValue ParseJson(TextReader jsonReader)
throws
SaxonApiException

Parse a JSON document supplied using a TextReader

Parameters:

jsonReader - Delivers the JSON input text

Returns:

Typically an XdmMap or XdmArray containing the parsed representation of the JSON input text. If the JSON comprises a single token, the returned value may be an XdmAtomicValue containing a string, number, or boolean; or an empty sequence representing JSON null.

Throws:

SaxonApiException - If the JSON input is invalid

parseJson

public XdmValue parseJson(TextReader jsonReader)
throws
SaxonApiException

Obsolete synonym of ParseJson.

Parameters:

jsonReader - Delivers the JSON input text

Returns:

Typically an XdmMap or XdmArray containing the parsed representation of the JSON input text. If the JSON comprises a single token, the returned value may be an XdmAtomicValue containing a string, number, or boolean; or an empty sequence representing JSON null.

Throws:

SaxonApiException - If the JSON input is invalid

ParseJson

public XdmValue ParseJson(string json)
throws
SaxonApiException

Parse a JSON document supplied as a string

Parameters:

json - Contains the JSON input text

Returns:

Typically an XdmMap or XdmArray containing the parsed representation of the JSON input text. If the JSON comprises a single token, the returned value may be an XdmAtomicValue containing a string, number, or boolean; or an empty sequence representing JSON null.

Throws:

SaxonApiException - If the JSON input is invalid

parseJson

public XdmValue parseJson(string json)
throws
SaxonApiException

Obsolete synonym of ParseJson

Parameters:

json - Contains the JSON input text

Returns:

Typically an XdmMap or XdmArray containing the parsed representation of the JSON input text. If the JSON comprises a single token, the returned value may be an XdmAtomicValue containing a string, number, or boolean; or an empty sequence representing JSON null.

Throws:

SaxonApiException - If the JSON input is invalid