Convert a character-stream into a token-stream.
Convert a character-stream into a token-stream.
This reads characters in blocks of size blockSize
, so if the
underlying Reader
is to be re-used for other non-JSON purposes
after finishing reading, a com.rojoma.json.v3.io.JsonTokenIterator
should be used instead.
As extensions to standard JSON, this reader supports single-quoted strings and Javascript-style comments.
Unless you actually need tokens, prefer com.rojoma.json.v3.io.FusedBlockJsonEventIterator.
An object that will write com.rojoma.json.v3.ast.JValues in a non-human-friendly "compact" format with no spaces or newlines.
An object that will write com.rojoma.json.v3.ast.JValues in a non-human-friendly
"compact" format with no spaces or newlines. This does many small
writes, so it is probably a good idea to wrap the Writer
in a BufferedWriter
.
Parses a token-stream into a com.rojoma.json.v3.ast.JValue.
Parses a token-stream into a com.rojoma.json.v3.ast.JValue. As an extension, this parser accepts unquoted strings (i.e., identifiers) as field-names.
A function for use in caching objects' field names, for memory reduction.
A function for use in caching objects' field names, for
memory reduction. In most places, this defaults to
identity
. In com.rojoma.json.v3.io.JsonReader however,
a com.rojoma.json.v3.io.HashMapFieldCache is used because
it is already known that the entire datum will be read into
memory at once.
The parameters are the field names and the depth of nesting at which it occurs.
A cache of keys that are known ahead of time.
Turns a raw character-stream into an event stream, checking for JSON well-formedness.
Turns a raw character-stream into an event stream, checking for JSON well-formedness.
A FusedBlockJsonEventIterator
checks a character stream for syntactic correctness
and produces events that reflect the syntax of JSON.
As extension, this class allows comments and for unquoted identifiers to be used as object keys.
This exception should never be thrown if using the standard
JsonEventIterator
.
This exception should never be thrown if using the standard
JsonEventIterator
. It means that either there were mismatched
start/end array or object events or that an an object did not
follow the pattern of FieldObject-followed-by-field-data.
Turns a raw token-stream into an event stream, checking for JSON well-formedness.
Turns a raw token-stream into an event stream, checking for JSON well-formedness.
A JsonEventIterator
checks a token stream for syntactic correctness
and produces events that reflect the syntax of JSON. It guarantees
to demand no more input from the input iterator than is absolutely
required.
As an extension, this class allows unquoted identifiers to be used as object keys.
Convert a character-stream into a token-stream.
Convert a character-stream into a token-stream.
This is guaranteed to read no more than necessary to ensure it has reached the end of a single token. For objects, arrays, and strings, it will read only up to (and, of course, including) the closing delimiter. For other types, it may read one character further to assure itself that it has reached the end.
A JsonTokenIterator
does many small reads; it may be a good idea
to wrap the input Reader
into a BufferedReader
. If you do not
need to read non-JSON out of the underlying Reader
afterward, a
com.rojoma.json.v3.io.BlockJsonTokenIterator maybe be faster.
As extensions to standard JSON, this reader supports single-quoted strings and Javascript-style comments.
An object that can serialize com.rojoma.json.v3.ast.JValues.
An object that can serialize com.rojoma.json.v3.ast.JValues. The intention is to produce a (series of) JSON objects.
An object that will write com.rojoma.json.v3.ast.JValues in a human-friendly indented format.
An object that will write com.rojoma.json.v3.ast.JValues in a human-friendly indented format.
The writer will try to keep as much data on a single line as possible. As a result, arrays and objects have two printing modes (selected automatically), "compact" and "indented".
In the "compact" mode, an array is stored on a single line:
[ elem1, elem2, ... ]
Similarly for objects:
{ "key1" : value1, "key2 : value2, ... }
In the "indented" mode, the delimiters appear on lines by themselves, with each element formatted on a separate line:
[ elem1, elem2, ... ]
For objects, if a key/value pair does not fit on a single line, the value is printed on a line of its own, indented further:
{
"key" :
value
}
Empty arrays and objects are always represented compactly,
as []
or {}
respectively.
This does many small writes, so it is probably a good idea to wrap
the Writer
in a BufferedWriter
.
A function which converts an Iterator[JsonEvent]
into an Iterator[JsonToken]
.
A function which converts an Iterator[JsonEvent]
into an Iterator[JsonToken]
.
An iterator of tokens that can be used to generate textual output
MalformedEventStreamException
if the event stream is not well-formed
A function which converts a JValue
into an Iterator[JsonEvent]
.
A function which converts a JValue
into an Iterator[JsonEvent]
.
An iterator of events that can be re-parsed or converted into tokens for output