public class Json
extends java.lang.Object
Constructor and Description |
---|
Json() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
asciiStringify(com.fasterxml.jackson.databind.JsonNode json)
Convert a JsonNode to its string representation, escaping non-ascii characters.
|
static <A> A |
fromJson(com.fasterxml.jackson.databind.JsonNode json,
java.lang.Class<A> clazz)
Convert a JsonNode to a Java value
|
static com.fasterxml.jackson.databind.ObjectMapper |
mapper()
Get the ObjectMapper used to serialize and deserialize objects to and from JSON values.
|
static com.fasterxml.jackson.databind.node.ArrayNode |
newArray()
Creates a new empty ArrayNode.
|
static com.fasterxml.jackson.databind.node.ObjectNode |
newObject()
Creates a new empty ObjectNode.
|
static com.fasterxml.jackson.databind.JsonNode |
parse(byte[] src)
Parse a byte array representing a json, and return it as a JsonNode.
|
static com.fasterxml.jackson.databind.JsonNode |
parse(java.io.InputStream src)
Parse a InputStream representing a json, and return it as a JsonNode.
|
static com.fasterxml.jackson.databind.JsonNode |
parse(java.lang.String src)
Parse a String representing a json, and return it as a JsonNode.
|
static java.lang.String |
prettyPrint(com.fasterxml.jackson.databind.JsonNode json)
Convert a JsonNode to its string representation.
|
static void |
setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper mapper)
Inject the object mapper to use.
|
static java.lang.String |
stringify(com.fasterxml.jackson.databind.JsonNode json)
Convert a JsonNode to its string representation.
|
static com.fasterxml.jackson.databind.JsonNode |
toJson(java.lang.Object data)
Convert an object to JsonNode.
|
public static com.fasterxml.jackson.databind.ObjectMapper mapper()
public static com.fasterxml.jackson.databind.JsonNode toJson(java.lang.Object data)
data
- Value to convert in Json.public static <A> A fromJson(com.fasterxml.jackson.databind.JsonNode json, java.lang.Class<A> clazz)
json
- Json value to convert.clazz
- Expected Java value type.public static com.fasterxml.jackson.databind.node.ObjectNode newObject()
public static com.fasterxml.jackson.databind.node.ArrayNode newArray()
public static java.lang.String stringify(com.fasterxml.jackson.databind.JsonNode json)
public static java.lang.String asciiStringify(com.fasterxml.jackson.databind.JsonNode json)
public static java.lang.String prettyPrint(com.fasterxml.jackson.databind.JsonNode json)
public static com.fasterxml.jackson.databind.JsonNode parse(java.lang.String src)
public static com.fasterxml.jackson.databind.JsonNode parse(java.io.InputStream src)
public static com.fasterxml.jackson.databind.JsonNode parse(byte[] src)
public static void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper mapper)