Package net.sf.saxon.ma.json

## Class JsonParser

- java.lang.Object
- - net.sf.saxon.ma.json.JsonParser

-     public class JsonParser
      extends java.lang.Object

  Parser for JSON, which notifies parsing events to a JsonHandler

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `ALLOW_ANY_TOP_LEVEL` |
    `static int` | `DEBUG` |
    `static int` | `DUPLICATES_FIRST` |
    `static int` | `DUPLICATES_LAST` |
    `static int` | `DUPLICATES_REJECTED` |
    `static int` | `DUPLICATES_RETAINED` |
    `static int` | `DUPLICATES_SPECIFIED` |
    `static int` | `ESCAPE` |
    `static int` | `LIBERAL` |
    `static int` | `VALIDATE` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `JsonParser()` | Create a JSON parser

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static int` | `getFlags​(java.util.Map<java.lang.String,​Sequence> options, XPathContext context, java.lang.Boolean allowValidate)` |
    `void` | `parse​(java.lang.String input, int flags, JsonHandler handler, XPathContext context)` | Parse the JSON string according to supplied options
    `static java.lang.String` | `toString​(net.sf.saxon.ma.json.JsonParser.JsonToken token, java.lang.String currentTokenValue)` |
    `static java.lang.String` | `unescape​(java.lang.String literal, int flags, java.lang.String errorCode, int lineNumber)` | Unescape a JSON string literal,

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ESCAPE

          public static final int ESCAPE

      See Also:
        Constant Field Values

    - #### ALLOW_ANY_TOP_LEVEL

          public static final int ALLOW_ANY_TOP_LEVEL

      See Also:
        Constant Field Values

    - #### LIBERAL

          public static final int LIBERAL

      See Also:
        Constant Field Values

    - #### VALIDATE

          public static final int VALIDATE

      See Also:
        Constant Field Values

    - #### DEBUG

          public static final int DEBUG

      See Also:
        Constant Field Values

    - #### DUPLICATES_RETAINED

          public static final int DUPLICATES_RETAINED

      See Also:
        Constant Field Values

    - #### DUPLICATES_LAST

          public static final int DUPLICATES_LAST

      See Also:
        Constant Field Values

    - #### DUPLICATES_FIRST

          public static final int DUPLICATES_FIRST

      See Also:
        Constant Field Values

    - #### DUPLICATES_REJECTED

          public static final int DUPLICATES_REJECTED

      See Also:
        Constant Field Values

    - #### DUPLICATES_SPECIFIED

          public static final int DUPLICATES_SPECIFIED

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### JsonParser

          public JsonParser()

      Create a JSON parser

  - ### Method Detail

    - #### parse

          public void parse​(java.lang.String input,
                            int flags,
                            JsonHandler handler,
                            XPathContext context)
                     throws XPathException

      Parse the JSON string according to supplied options
      Parameters:
        `input` - JSON input string
        `flags` - options for the conversion as a map of xs:string : value pairs
        `handler` - event handler to which parsing events are notified
        `context` - XPath evaluation context
      Throws:
        `XPathException` - if the syntax of the input is incorrect

    - #### getFlags

          public static int getFlags​(java.util.Map<java.lang.String,​Sequence> options,
                                     XPathContext context,
                                     java.lang.Boolean allowValidate)
                              throws XPathException

      Throws:
        `XPathException`

    - #### unescape

          public static java.lang.String unescape​(java.lang.String literal,
                                                  int flags,
                                                  java.lang.String errorCode,
                                                  int lineNumber)
                                           throws XPathException

      Unescape a JSON string literal,
      Parameters:
        `literal` - the string literal to be processed
        `flags` - parsing options
        `errorCode` - Error code
      Returns:
        the result of parsing and conversion to XDM
      Throws:
        `XPathException` - if a dynamic error occurs (such as invalid JSON input)

    - #### toString

          public static java.lang.String toString​(net.sf.saxon.ma.json.JsonParser.JsonToken token,
                                                  java.lang.String currentTokenValue)