java.lang.Object
com.grack.nanojson.JsonReader
Streaming reader for JSON documents.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe type of value that theJsonReaderis positioned over. -
Method Summary
Modifier and TypeMethodDescriptionvoidarray()Starts reading an array at the current value.booleanbool()Parses the current value as a boolean.current()Returns the current type of the value.doubleParses the current value as a double.floatfloatVal()Parses the current value as a float.static JsonReaderfrom(InputStream in) Create aJsonReaderfrom anInputStream.static JsonReaderCreate aJsonReaderfrom aString.intintVal()Parses the current value as an integer.key()Reads the key for the object at the current value.longlongVal()Parses the current value as a long.booleannext()Advance to the next value in this array or object.voidnul()Parses the current value as a null.number()Parses the current value as aNumber.voidobject()Starts reading an object at the current value.booleanpop()Returns to the array or object structure above the current one, and advances to the next key or value.string()Parses the current value as a string.value()Returns the current value.
-
Method Details
-
from
Create aJsonReaderfrom anInputStream.- Throws:
JsonParserException
-
from
Create aJsonReaderfrom aString.- Throws:
JsonParserException
-
pop
Returns to the array or object structure above the current one, and advances to the next key or value.- Throws:
JsonParserException
-
current
Returns the current type of the value.- Throws:
JsonParserException
-
object
Starts reading an object at the current value.- Throws:
JsonParserException
-
key
Reads the key for the object at the current value. Does not advance to the next value.- Throws:
JsonParserException
-
array
Starts reading an array at the current value.- Throws:
JsonParserException
-
value
Returns the current value.- Throws:
JsonParserException
-
nul
Parses the current value as a null.- Throws:
JsonParserException
-
string
Parses the current value as a string.- Throws:
JsonParserException
-
bool
Parses the current value as a boolean.- Throws:
JsonParserException
-
number
Parses the current value as aNumber.- Throws:
JsonParserException
-
longVal
Parses the current value as a long.- Throws:
JsonParserException
-
intVal
Parses the current value as an integer.- Throws:
JsonParserException
-
floatVal
Parses the current value as a float.- Throws:
JsonParserException
-
doubleVal
Parses the current value as a double.- Throws:
JsonParserException
-
next
Advance to the next value in this array or object. If no values remain, return to the parent array or object.- Returns:
- true if we still have values to read in this array or object, false if we have completed this object (and implicitly moved back to the parent array or object)
- Throws:
JsonParserException
-