public class JsonUtil extends Object
Modifier and Type | Method and Description |
---|---|
static com.fasterxml.jackson.databind.node.ArrayNode |
ensureArray(com.fasterxml.jackson.databind.node.ObjectNode node,
String field)
Creates an empty array if missing
|
static com.fasterxml.jackson.databind.node.ObjectNode |
ensureObject(com.fasterxml.jackson.databind.node.ObjectNode node,
String field)
Creates an empty array if missing
|
static com.fasterxml.jackson.databind.JsonNode |
getFromFile(String filePath) |
static <T> T |
getObjFromFile(String filePath,
Class<T> clazz) |
static String |
jsonNodeToJson(com.fasterxml.jackson.databind.JsonNode node) |
static <T> T |
jsonNodeToObject(com.fasterxml.jackson.databind.JsonNode node,
Class<T> clazz) |
static <T> List<T> |
jsoNodeToList(com.fasterxml.jackson.databind.JsonNode node,
Class<T> clazz) |
static com.fasterxml.jackson.databind.JsonNode |
jsonToJsonNode(String json) |
static <T> T |
jsonToObject(String json,
Class<T> clazz) |
static <T> String |
objectToJson(T object) |
static <T> com.fasterxml.jackson.databind.JsonNode |
objectToJsonNode(T obj) |
public static com.fasterxml.jackson.databind.JsonNode jsonToJsonNode(String json)
public static String jsonNodeToJson(com.fasterxml.jackson.databind.JsonNode node)
public static <T> T jsonNodeToObject(com.fasterxml.jackson.databind.JsonNode node, Class<T> clazz)
public static <T> com.fasterxml.jackson.databind.JsonNode objectToJsonNode(T obj)
public static <T> List<T> jsoNodeToList(com.fasterxml.jackson.databind.JsonNode node, Class<T> clazz)
public static <T> String objectToJson(T object)
public static com.fasterxml.jackson.databind.JsonNode getFromFile(String filePath)
public static com.fasterxml.jackson.databind.node.ArrayNode ensureArray(com.fasterxml.jackson.databind.node.ObjectNode node, String field)
node
- object to create the array withinfield
- location to create the arraypublic static com.fasterxml.jackson.databind.node.ObjectNode ensureObject(com.fasterxml.jackson.databind.node.ObjectNode node, String field)
node
- objectnode to create the object withinfield
- location to create the objectCopyright © 2018 The Apache Software Foundation. All rights reserved.