public class JsonUtility extends Object
| Modifier and Type | Method and Description |
|---|---|
static List<String> |
getCodes(String content)
Extracts the codes from the input.
|
static com.fasterxml.jackson.databind.JsonNode |
getNode(String json)
Parse the JSON string into a
JsonNode object. |
static com.fasterxml.jackson.databind.JsonNode |
getNode(String json,
String field)
Parse the JSON string into a
JsonNode object with the specified field as root field. |
static <T> List<T> |
jsonToListOf(com.fasterxml.jackson.databind.JsonNode node,
Class<T> clazz)
Converts the
JsonNode into a list of the specified class. |
static <T> List<T> |
jsonToListOf(String json,
Class<T> clazz)
Converts the JSON string into a list of the specified class.
|
static com.fasterxml.jackson.databind.JsonNode |
toConventionalJson(String json)
Converts the non-conventional JSON response from the SCB API into a more conventional format,
wrapped in a
JsonNode. |
public static com.fasterxml.jackson.databind.JsonNode getNode(String json)
JsonNode object.json - the JSON contentJsonNode objectpublic static com.fasterxml.jackson.databind.JsonNode getNode(String json, String field)
JsonNode object with the specified field as root field.json - the JSON contentfield - the field in the JSON to become the rootJsonNode object with the specified field as root.public static com.fasterxml.jackson.databind.JsonNode toConventionalJson(String json)
JsonNode.json - the json to formatpublic static <T> List<T> jsonToListOf(com.fasterxml.jackson.databind.JsonNode node, Class<T> clazz)
JsonNode into a list of the specified class.T - the data type of the listnode - the node to processclazz - the class to convert each JSON entry toJsonNodepublic static <T> List<T> jsonToListOf(String json, Class<T> clazz)
T - the data type of the listjson - the json to processclazz - the class to convert each JSON entry toCopyright © 2016. All rights reserved.