public final class CompactJsonFormatter extends java.lang.Object implements JsonFormatter
Constructor and Description |
---|
CompactJsonFormatter() |
Modifier and Type | Method and Description |
---|---|
static CompactJsonFormatter |
fieldOrderNormalisingCompactJsonFormatter()
Gets a
JsonFormatter that formats JSON as compactly as possible, outputting the fields of objects in alphabetic order. |
static CompactJsonFormatter |
fieldOrderPreservingCompactJsonFormatter()
Gets a
JsonFormatter that formats JSON as compactly as possible, outputting the fields of objects in the order they were defined. |
java.lang.String |
format(JsonNode jsonNode)
Returns the specified
JsonNode formatted as a String. |
void |
format(JsonNode jsonNode,
java.io.Writer writer)
Streams the specified
JsonNode formatted to the specified Writer . |
public static CompactJsonFormatter fieldOrderPreservingCompactJsonFormatter()
JsonFormatter
that formats JSON as compactly as possible, outputting the fields of objects in the order they were defined.JsonFormatter
that formats JSON as compactly as possible, outputting the fields of objects in the order they were defined.public static CompactJsonFormatter fieldOrderNormalisingCompactJsonFormatter()
JsonFormatter
that formats JSON as compactly as possible, outputting the fields of objects in alphabetic order.JsonFormatter
that formats JSON as compactly as possible, outputting the fields of objects in alphabetic order.public java.lang.String format(JsonNode jsonNode)
JsonFormatter
JsonNode
formatted as a String.format
in interface JsonFormatter
jsonNode
- the JsonNode
to format.JsonNode
formatted as a String.public void format(JsonNode jsonNode, java.io.Writer writer) throws java.io.IOException
JsonFormatter
JsonNode
formatted to the specified Writer
.format
in interface JsonFormatter
jsonNode
- the JsonNode
to format.writer
- the Writer
to stream the formatted JsonNode
to.java.io.IOException
- if there was a problem writing to the Writer
.