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 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(InputStream stream)`
Constructor with InputStream.
`JSONParser(InputStream stream, String encoding)`
Constructor with InputStream and supplied encoding
`JSONParser(Reader stream)`
Constructor.
`JSONParser(String input)`
`JSONParser(JSONParserTokenManager tm)`
Constructor with generated Token Manager.

## Method Summary

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

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

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

## Field Details

### token_source

public JSONParserTokenManager token_source
Generated Token Manager.

### token

public Token token
Current token.

### jj_nt

public Token jj_nt
Next token.

## Constructor Details

### JSONParser

public JSONParser(String input)

### JSONParser

public JSONParser(InputStream stream)
Constructor with InputStream.

### JSONParser

public JSONParser(InputStream stream, String encoding)
Constructor with InputStream and supplied encoding

### JSONParser

public JSONParser(Reader stream)
Constructor.

### JSONParser

public JSONParser(JSONParserTokenManager tm)
Constructor with generated Token Manager.

## Method Details

### parseObject

public LinkedHashMap<String,Object> parseObject() throws ParseException
Parses a JSON object into a Java `Map`.

Throws:
  `ParseException`

### parseArray

public ArrayList<Object> parseArray() throws ParseException
Parses a JSON array into a Java `List`.

Throws:
  `ParseException`

### parse

public 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 Object anything() throws ParseException

Throws:
  `ParseException`

### objectKey

public final String objectKey() throws ParseException

Throws:
  `ParseException`

### object

public final LinkedHashMap<String,Object> object() throws ParseException

Throws:
  `ParseException`

### list

public final ArrayList<Object> list() throws ParseException

Throws:
  `ParseException`

### value

public final Object value() throws ParseException

Throws:
  `ParseException`

### nullValue

public final Object nullValue() throws ParseException

Throws:
  `ParseException`

### booleanValue

public final Boolean booleanValue() throws ParseException

Throws:
  `ParseException`

### number

public final Number number() throws ParseException

Throws:
  `ParseException`

### string

public final String string() throws ParseException

Throws:
  `ParseException`

### doubleQuoteString

public final String doubleQuoteString() throws ParseException

Throws:
  `ParseException`

### singleQuoteString

public final String singleQuoteString() throws ParseException

Throws:
  `ParseException`

### symbol

public final String symbol() throws ParseException

Throws:
  `ParseException`

### ReInit

public void ReInit(InputStream stream)
Reinitialise.

### ReInit

public void ReInit(InputStream stream, String encoding)
Reinitialise.

### ReInit

public void ReInit(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.