public class JsonBuilder
extends java.lang.Object
JsonBuilder is used to parse JSON documents| Modifier | Constructor and Description |
|---|---|
protected |
JsonBuilder(Configuration config) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isLiberal()
Ask whether JSON parsing should be liberal.
|
XdmValue |
parseJson(java.io.Reader jsonReader)
Parse a JSON input string, supplied as a
Reader and construct an XdmValue representing
its content. |
XdmValue |
parseJson(java.lang.String json)
Parse a JSON input string, supplied as a
String and construct an XdmValue representing
its content. |
void |
setLiberal(boolean liberal)
Say whether JSON parsing should be liberal.
|
protected JsonBuilder(Configuration config)
public void setLiberal(boolean liberal)
Specifically, liberal mode currently allows:
liberal - - true if parsing is to be liberal, false if it is to be strictpublic boolean isLiberal()
public XdmValue parseJson(java.io.Reader jsonReader) throws SaxonApiException
Reader and construct an XdmValue representing
its content. The XdmValue will usually be an XdmMap or XdmArray.
If the JSON input consists simply of a string, number, or boolean, then the result will be an
XdmAtomicValue. If the input is the JSON string "null", the method returns an
XdmEmptySequence.
The method follows the rules of the fn:parse-json() function when called with
default options.
jsonReader - supplies the input JSON as a stream of charactersXdmItem in all cases except
where the input JSON text is the string "null".SaxonApiException - if the JSON input is invalid, or if the reader throws an IOExceptionpublic XdmValue parseJson(java.lang.String json) throws SaxonApiException
String and construct an XdmValue representing
its content. The XdmValue will usually be an XdmMap or XdmArray.
If the JSON input consists simply of a string, number, or boolean, then the result will be an
XdmAtomicValue. If the input is the JSON string "null", the method returns an
XdmEmptySequence.
The method follows the rules of the fn:parse-json() function when called with
default options.
json - supplies the input JSON as a stringSaxonApiException - if the JSON input is invalidCopyright (c) 2004-2022 Saxonica Limited. All rights reserved.