Package org.rumbledb.items.parsing
Class JSONParser
java.lang.Object
org.rumbledb.items.parsing.JSONParser
Parser for JSON texts used by
fn:parse-json and fn:json-doc.
The parser converts JSON values to RumbleDB items. It supports the
parse-json options liberal, duplicates,
escape, and fallback.
If liberal is false, the input must follow the JSON grammar
strictly. If liberal is true, this implementation accepts
selected JSON extensions, including:
- single-quoted strings
- unquoted object keys
- comments
- trailing commas
- leading plus signs
- leading zeroes
- unescaped control characters
String parsing keeps two representations:
-
resultValue: the string value stored in the resulting item -
keyComparisonValue: the value used to detect duplicate object keys
These can differ when escape=false and invalid XML characters are
replaced using the fallback function.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Itemparse(String jsonText, JSONParsingOptions options, String xmlVersion, boolean isJSONiq10, ExceptionMetadata metadata)
-
Method Details
-
parse
public static Item parse(String jsonText, JSONParsingOptions options, String xmlVersion, boolean isJSONiq10, ExceptionMetadata metadata)
-