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.
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:
Similarly for objects:
In the "indented" mode, the delimiters appear on lines by themselves, with each element formatted on a separate line:
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 aBufferedWriter
.