Class ToonEncoder
java.lang.Object
io.micronaut.serde.toon.util.ToonEncoder
Writes a JSON tree as a TOON document.
Array form (inline, tabular, keyed-tabular, or list) is chosen by inspecting all elements of an array, or all values of an object for keyed-tabular form, before writing.
An array or keyed object is tabular-eligible only when every element declares the same set of keys (order may vary per element); a differing key set falls back to list form. The header - and the order cells are emitted in for every row - is taken from the first element.
- Since:
- 3.3.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionToonEncoder(SerdeToonConfiguration toonConfiguration) Creates a TOON encoder. -
Method Summary
Modifier and TypeMethodDescriptionvoidwrite(OutputStream outputStream, io.micronaut.json.tree.JsonNode tree) Writes the given JSON tree to the output stream as a TOON document.
-
Constructor Details
-
ToonEncoder
Creates a TOON encoder.- Parameters:
toonConfiguration- The TOON format configuration
-
-
Method Details
-
write
public void write(OutputStream outputStream, io.micronaut.json.tree.JsonNode tree) throws IOException Writes the given JSON tree to the output stream as a TOON document.- Parameters:
outputStream- The destination streamtree- The tree to encode as TOON- Throws:
IOException- If the TOON output cannot be written
-