public class JsonHelper extends Object
Modifier and Type | Method and Description |
---|---|
static org.codehaus.jackson.map.ObjectMapper |
getSharedObjectMapper()
Returns a pre-configured ObjectMapper which (and especially its JSON and node factories) can
be reused.
|
static org.codehaus.jackson.JsonNode |
readJsonTree(String jsonString)
Deserialize a JSON string into a JSON tree.
|
static void |
writeJsonTree(Writer writer,
org.codehaus.jackson.JsonNode rootNode)
Serialize a JSON tree.
|
static String |
writeJsonTreeAsString(org.codehaus.jackson.JsonNode rootNode)
Converts a JSON tree into a string and ignores exceptions.
|
public static org.codehaus.jackson.map.ObjectMapper getSharedObjectMapper()
public static org.codehaus.jackson.JsonNode readJsonTree(String jsonString)
jsonString
- the string to parsepublic static void writeJsonTree(Writer writer, org.codehaus.jackson.JsonNode rootNode) throws IOException
writer
- the writer to write torootNode
- the root node of the JSON object structureIOException
- in case of an exception while serializing the json objectpublic static String writeJsonTreeAsString(org.codehaus.jackson.JsonNode rootNode)
rootNode
- the root node of the tree, can be null to produce a null nodeCopyright © 2019 Communote team. All rights reserved.