Package org.apache.streams.jackson
Class JsonUtil
java.lang.Object
org.apache.streams.jackson.JsonUtil
JSON utilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.fasterxml.jackson.databind.node.ArrayNodeensureArray(com.fasterxml.jackson.databind.node.ObjectNode node, String field) Creates an empty array if missingstatic com.fasterxml.jackson.databind.node.ObjectNodeensureObject(com.fasterxml.jackson.databind.node.ObjectNode node, String field) Creates an empty array if missingstatic com.fasterxml.jackson.databind.JsonNodegetFromFile(String filePath) static <T> TgetObjFromFile(String filePath, Class<T> clazz) static StringjsonNodeToJson(com.fasterxml.jackson.databind.JsonNode node) static <T> TjsonNodeToObject(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.JsonNodejsonToJsonNode(String json) static <T> TjsonToObject(String json, Class<T> clazz) static <T> StringobjectToJson(T object) static <T> com.fasterxml.jackson.databind.JsonNodeobjectToJsonNode(T obj)
-
Method Details
-
jsonToJsonNode
-
jsonNodeToJson
-
jsonToObject
-
jsonNodeToObject
-
objectToJsonNode
public static <T> com.fasterxml.jackson.databind.JsonNode objectToJsonNode(T obj) -
jsoNodeToList
-
objectToJson
-
getObjFromFile
-
getFromFile
-
ensureArray
public static com.fasterxml.jackson.databind.node.ArrayNode ensureArray(com.fasterxml.jackson.databind.node.ObjectNode node, String field) Creates an empty array if missing- Parameters:
node- object to create the array withinfield- location to create the array- Returns:
- the Map representing the extensions property
-
ensureObject
public static com.fasterxml.jackson.databind.node.ObjectNode ensureObject(com.fasterxml.jackson.databind.node.ObjectNode node, String field) Creates an empty array if missing- Parameters:
node- objectnode to create the object withinfield- location to create the object- Returns:
- the Map representing the extensions property
-