JSONParser (Apache Tomcat 8.5.96 API Documentation)

Package org.apache.tomcat.util.json

## Class JSONParser

- java.lang.Object
- - org.apache.tomcat.util.json.JSONParser

- All Implemented Interfaces:
    `JSONParserConstants`

      public class JSONParser
      extends java.lang.Object
      implements JSONParserConstants

  Basic JSON parser generated by JavaCC. It consumes the input provided through the constructor when `parseObject()`, `parseList()`, or `parse()` are called, and there is no way to directly reset the state.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `Token` | `jj_nt` | Next token.
    `Token` | `token` | Current token.
    `JSONParserTokenManager` | `token_source` | Generated Token Manager.

    - ### Fields inherited from interface org.apache.tomcat.util.json.JSONParserConstants

      `BRACE_CLOSE, BRACE_OPEN, BRACKET_CLOSE, BRACKET_OPEN, C_MULTILINE_COMMENT, C_SINGLE_COMMENT, COLON, COMMA, DEFAULT, DIGIT, DIGIT_NONZERO, EOF, EOL, FALSE, NULL, NUMBER_DECIMAL, NUMBER_INTEGER, QUOTE_DOUBLE, QUOTE_SINGLE, SH_SINGLE_COMMENT, STRING_DOUBLE_BODY, STRING_DOUBLE_EMPTY, STRING_DOUBLE_NONEMPTY, STRING_SINGLE_BODY, STRING_SINGLE_EMPTY, STRING_SINGLE_NONEMPTY, SYMBOL, tokenImage, TRUE, WHITESPACE, ZERO`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `JSONParser​(java.io.InputStream stream)` | Constructor with InputStream.
    `JSONParser​(java.io.InputStream stream, java.lang.String encoding)` | Constructor with InputStream and supplied encoding
    `JSONParser​(java.io.Reader stream)` | Constructor.
    `JSONParser​(java.lang.String input)` |
    `JSONParser​(JSONParserTokenManager tm)` | Constructor with generated Token Manager.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.Object` | `anything()` |
    `java.lang.Boolean` | `booleanValue()` |
    `void` | `disable_tracing()` | Disable tracing.
    `java.lang.String` | `doubleQuoteString()` |
    `void` | `enable_tracing()` | Enable tracing.
    `boolean` | `ensureEOF()` |
    `ParseException` | `generateParseException()` | Generate ParseException.
    `boolean` | `getNativeNumbers()` |
    `Token` | `getNextToken()` | Get the next Token.
    `Token` | `getToken​(int index)` | Get the specific Token.
    `java.util.ArrayList<java.lang.Object>` | `list()` |
    `java.lang.Object` | `nullValue()` |
    `java.lang.Number` | `number()` |
    `java.util.LinkedHashMap<java.lang.String,​java.lang.Object>` | `object()` |
    `java.lang.String` | `objectKey()` |
    `java.lang.Object` | `parse()` | Parses any JSON-parseable object, returning the value.
    `java.util.ArrayList<java.lang.Object>` | `parseArray()` | Parses a JSON array into a Java `List`.
    `java.util.LinkedHashMap<java.lang.String,​java.lang.Object>` | `parseObject()` | Parses a JSON object into a Java `Map`.
    `void` | `ReInit​(java.io.InputStream stream)` | Reinitialise.
    `void` | `ReInit​(java.io.InputStream stream, java.lang.String encoding)` | Reinitialise.
    `void` | `ReInit​(java.io.Reader stream)` | Reinitialise.
    `void` | `ReInit​(JSONParserTokenManager tm)` | Reinitialise.
    `void` | `setNativeNumbers​(boolean value)` |
    `java.lang.String` | `singleQuoteString()` |
    `java.lang.String` | `string()` |
    `java.lang.String` | `symbol()` |
    `boolean` | `trace_enabled()` | Trace enabled.
    `java.lang.Object` | `value()` |

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

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

- - ### Field Detail

    - #### token_source

          public JSONParserTokenManager token_source

      Generated Token Manager.

    - #### token

          public Token token

      Current token.

    - #### jj_nt

          public Token jj_nt

      Next token.

  - ### Constructor Detail

    - #### JSONParser

          public JSONParser​(java.lang.String input)

    - #### JSONParser

          public JSONParser​(java.io.InputStream stream)

      Constructor with InputStream.

    - #### JSONParser

          public JSONParser​(java.io.InputStream stream,
                            java.lang.String encoding)

      Constructor with InputStream and supplied encoding

    - #### JSONParser

          public JSONParser​(java.io.Reader stream)

      Constructor.

    - #### JSONParser

          public JSONParser​(JSONParserTokenManager tm)

      Constructor with generated Token Manager.

  - ### Method Detail

    - #### parseObject

          public java.util.LinkedHashMap<java.lang.String,​java.lang.Object> parseObject()
                                                                                       throws ParseException

      Parses a JSON object into a Java `Map`.
      Throws:
        `ParseException`

    - #### parseArray

          public java.util.ArrayList<java.lang.Object> parseArray()
                                                           throws ParseException

      Parses a JSON array into a Java `List`.
      Throws:
        `ParseException`

    - #### parse

          public java.lang.Object parse()
                                 throws ParseException

      Parses any JSON-parseable object, returning the value.
      Throws:
        `ParseException`

    - #### setNativeNumbers

          public void setNativeNumbers​(boolean value)

    - #### getNativeNumbers

          public boolean getNativeNumbers()

    - #### ensureEOF

          public final boolean ensureEOF()
                                  throws ParseException

      Throws:
        `ParseException`

    - #### anything

          public final java.lang.Object anything()
                                          throws ParseException

      Throws:
        `ParseException`

    - #### objectKey

          public final java.lang.String objectKey()
                                           throws ParseException

      Throws:
        `ParseException`

    - #### object

          public final java.util.LinkedHashMap<java.lang.String,​java.lang.Object> object()
                                                                                        throws ParseException

      Throws:
        `ParseException`

    - #### list

          public final java.util.ArrayList<java.lang.Object> list()
                                                           throws ParseException

      Throws:
        `ParseException`

    - #### value

          public final java.lang.Object value()
                                       throws ParseException

      Throws:
        `ParseException`

    - #### nullValue

          public final java.lang.Object nullValue()
                                           throws ParseException

      Throws:
        `ParseException`

    - #### booleanValue

          public final java.lang.Boolean booleanValue()
                                               throws ParseException

      Throws:
        `ParseException`

    - #### number

          public final java.lang.Number number()
                                        throws ParseException

      Throws:
        `ParseException`

    - #### string

          public final java.lang.String string()
                                        throws ParseException

      Throws:
        `ParseException`

    - #### doubleQuoteString

          public final java.lang.String doubleQuoteString()
                                                   throws ParseException

      Throws:
        `ParseException`

    - #### singleQuoteString

          public final java.lang.String singleQuoteString()
                                                   throws ParseException

      Throws:
        `ParseException`

    - #### symbol

          public final java.lang.String symbol()
                                        throws ParseException

      Throws:
        `ParseException`

    - #### ReInit

          public void ReInit​(java.io.InputStream stream)

      Reinitialise.

    - #### ReInit

          public void ReInit​(java.io.InputStream stream,
                             java.lang.String encoding)

      Reinitialise.

    - #### ReInit

          public void ReInit​(java.io.Reader stream)

      Reinitialise.

    - #### ReInit

          public void ReInit​(JSONParserTokenManager tm)

      Reinitialise.

    - #### getNextToken

          public final Token getNextToken()

      Get the next Token.

    - #### getToken

          public final Token getToken​(int index)

      Get the specific Token.

    - #### generateParseException

          public ParseException generateParseException()

      Generate ParseException.

    - #### trace_enabled

          public final boolean trace_enabled()

      Trace enabled.

    - #### enable_tracing

          public final void enable_tracing()

      Enable tracing.

    - #### disable_tracing

          public final void disable_tracing()

      Disable tracing.