public final class JacksonUtils
extends java.lang.Object
This class provides utility methods to get a JsonNodeFactory
and
a preconfigured ObjectReader
. It can also be used to return
preconfigured instances of ObjectMapper
(see newMapper()
.
Modifier and Type | Method and Description |
---|---|
static java.util.Map<java.lang.String,com.fasterxml.jackson.databind.JsonNode> |
asMap(com.fasterxml.jackson.databind.JsonNode node)
Return a map out of an object's members
|
static com.fasterxml.jackson.databind.ObjectReader |
getReader()
Return a preconfigured
ObjectReader to read JSON inputs |
static com.fasterxml.jackson.databind.ObjectMapper |
newMapper()
Return a preconfigured
ObjectMapper |
static com.fasterxml.jackson.databind.node.JsonNodeFactory |
nodeFactory()
Return a preconfigured
JsonNodeFactory to generate JSON data as
JsonNode s |
static java.lang.String |
prettyPrint(com.fasterxml.jackson.databind.JsonNode node)
Pretty print a JSON value
|
public static com.fasterxml.jackson.databind.ObjectReader getReader()
ObjectReader
to read JSON inputsnewMapper()
public static com.fasterxml.jackson.databind.node.JsonNodeFactory nodeFactory()
JsonNodeFactory
to generate JSON data as
JsonNode
spublic static java.util.Map<java.lang.String,com.fasterxml.jackson.databind.JsonNode> asMap(com.fasterxml.jackson.databind.JsonNode node)
If the node given as an argument is not a map, an empty map is returned.
node
- the nodepublic static java.lang.String prettyPrint(com.fasterxml.jackson.databind.JsonNode node)
node
- the JSON value to printnewMapper()
public static com.fasterxml.jackson.databind.ObjectMapper newMapper()
ObjectMapper
The returned mapper will have the following features enabled:
DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS
;SerializationFeature.WRITE_BIGDECIMAL_AS_PLAIN
;SerializationFeature.INDENT_OUTPUT
.This returns a new instance each time.
ObjectMapper