Package com.github.tnakamot.json.parser
Class JSONParser
- java.lang.Object
-
- com.github.tnakamot.json.parser.JSONParser
-
-
Constructor Summary
Constructors Constructor Description JSONParser(List<JSONToken> tokens, JSONParserErrorHandlingOptions options)
Create an instance of JSON parse for the given sequence of JSON tokens.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull JSONParserResult
parse()
Parse the given sequence of JSON tokens and return the root JSON value.@NotNull JSONParserResult
parse(boolean immutable)
Parse the given sequence of JSON tokens and return the root JSON value.
-
-
-
Constructor Detail
-
JSONParser
public JSONParser(List<JSONToken> tokens, JSONParserErrorHandlingOptions options)
Create an instance of JSON parse for the given sequence of JSON tokens.- Parameters:
tokens
- a sequence of JSON tokens to parseoptions
- settings of error message format ofJSONParserException
-
-
Method Detail
-
parse
@NotNull public @NotNull JSONParserResult parse() throws JSONParserException
Parse the given sequence of JSON tokens and return the root JSON value.The returned object is immutable.
- Returns:
- parser result
- Throws:
JSONParserException
- if there is a semantic error in the sequence of JSON tokens- See Also:
- RFC 8259 - 2. JSON Grammer
-
parse
@NotNull public @NotNull JSONParserResult parse(boolean immutable) throws JSONParserException
Parse the given sequence of JSON tokens and return the root JSON value.- Parameters:
immutable
- Specify false to create a JSON value tree with modifiable 'object' and 'array'.- Returns:
- parse result
- Throws:
JSONParserException
- if there is a semantic error in the sequence of JSON tokens- See Also:
- RFC 8259 - 2. JSON Grammer
-
-