public final class JsonParser
extends java.lang.Object
Instances of this class are immutable, reusable, and thread-safe.
| Modifier and Type | Class and Description | 
|---|---|
| static class  | JsonParser.NodeInterningStrategyStrategies a  JsonParsercan use for object reuse when parsing a document without streaming. | 
| static class  | JsonParser.PositionTrackingSettings a  JsonParsercan use for tracking parsing position for error reporting. | 
| static class  | JsonParser.PrevalidatedNumberInternal class | 
| Constructor and Description | 
|---|
| JsonParser() | 
| Modifier and Type | Method and Description | 
|---|---|
| JsonParser | nodeInterning(JsonParser.NodeInterningStrategy nodeInterningStrategy)Returns a JsonParser with the given node interning strategy. | 
| JsonNode | parse(java.io.Reader reader)Parses the character stream from the given  Readerinto aJsonNodeobject. | 
| JsonNode | parse(java.lang.String json)Parses the given JSON  Stringinto aJsonNodeobject. | 
| java.util.Iterator<JsonStreamElement> | parseStreaming(java.io.Reader reader)Parses the character stream from the given  Readerinto anIteratorofJsonStreamElements. | 
| void | parseStreaming(java.io.Reader reader,
              JsonListener jsonListener)Parses the character stream from the given  Readerinto calls to the given JsonListener. | 
| java.util.Iterator<JsonStreamElement> | parseStreaming(java.lang.String json)Parses the given JSON  Stringinto anIteratorofJsonStreamElements. | 
| void | parseStreaming(java.lang.String json,
              JsonListener jsonListener)Parses the given JSON  Stringinto calls to the given JsonListener. | 
| JsonParser | positionTracking(JsonParser.PositionTracking positionTracking)Returns a JsonParser with the given position tracking setting. | 
public JsonParser nodeInterning(JsonParser.NodeInterningStrategy nodeInterningStrategy)
JsonParser.NodeInterningStrategy.INTERN_LEAF_NODES.nodeInterningStrategy - the node interning strategy to use when parsing without streaming.public JsonParser positionTracking(JsonParser.PositionTracking positionTracking)
JsonParser.PositionTracking.TRACK.positionTracking - the position tracking setting to use.public JsonNode parse(java.io.Reader reader) throws InvalidSyntaxException, java.io.IOException
Reader into a JsonNode object.reader - the Reader to parse.JsonNode representing the JSON read from the given Reader.InvalidSyntaxException - if the characters streamed from the given Reader do not represent valid JSON.java.io.IOException - rethrown when reading characters from the given Reader throws IOException.public JsonNode parse(java.lang.String json) throws InvalidSyntaxException
String into a JsonNode object.json - the String to parse.JsonNode representing the JSON read from the given String.InvalidSyntaxException - if the characters streamed from the given String do not represent valid JSON.public java.util.Iterator<JsonStreamElement> parseStreaming(java.io.Reader reader)
Reader into an Iterator of JsonStreamElements.
 
 The next() and hasNext() methods of the returned Iterator throw
 
InvalidSyntaxRuntimeException if the next element could not be read, for example if the next element turns out not to be valid JSONJsonStreamException if the underlying character stream failed.reader - the Reader to parse.Iterator of JsonStreamElements reading from the given Reader.public java.util.Iterator<JsonStreamElement> parseStreaming(java.lang.String json)
String into an Iterator of JsonStreamElements.
 
 The next() and hasNext() methods of the returned Iterator throw
 
InvalidSyntaxRuntimeException if the next element could not be read, for example if the next element turns out not to be valid JSONJsonStreamException if the underlying character stream failed.json - the String to parse.Iterator of JsonStreamElements reading from the given Reader.public void parseStreaming(java.io.Reader reader,
                           JsonListener jsonListener)
                    throws InvalidSyntaxException,
                           java.io.IOException
Reader into calls to the given JsonListener.reader - the Reader to parse.jsonListener - the JsonListener to notify of parsing eventsInvalidSyntaxException - if the characters streamed from the given Reader do not represent valid JSON.java.io.IOException - rethrown when reading characters from the given Reader throws IOException.public void parseStreaming(java.lang.String json,
                           JsonListener jsonListener)
                    throws InvalidSyntaxException
String into calls to the given JsonListener.json - the String to parse.jsonListener - the JsonListener to notify of parsing eventsInvalidSyntaxException - if the characters streamed from the given String do not represent valid JSON.