public class JsonUtils extends Object
| Constructor and Description |
|---|
JsonUtils() |
| Modifier and Type | Method and Description |
|---|---|
static com.fasterxml.jackson.databind.JsonNode |
convertToJson(Object source,
String label)
Converts object to JSON.
|
static com.fasterxml.jackson.databind.JsonNode |
convertToJsonQuoteIfNeeded(Object source,
String label)
Converts object to JSON, quotes the String value if it is needed (not a valid JSON object)
|
static com.fasterxml.jackson.databind.JsonNode |
getNode(Object root,
String path)
Returns node with given path.
|
static boolean |
nodeExists(Object json,
String path)
Returns true if the node exists.
|
static Object |
quoteIfNeeded(Object source)
Add quotes around the object iff it's not a JSON object.
|
static com.fasterxml.jackson.databind.JsonNode |
readValue(Reader value,
String label)
Parses value from Reader.
|
static com.fasterxml.jackson.databind.JsonNode |
readValue(String value,
String label)
Parses value from String.
|
public static com.fasterxml.jackson.databind.JsonNode readValue(String value, String label)
value - label - label to be logged in case of error.public static com.fasterxml.jackson.databind.JsonNode readValue(Reader value, String label)
value - label - label to be logged in case of error.public static com.fasterxml.jackson.databind.JsonNode convertToJson(Object source, String label)
source - label - label to be logged in case of error.public static com.fasterxml.jackson.databind.JsonNode convertToJsonQuoteIfNeeded(Object source, String label)
source - label - label to be logged in case of error.public static com.fasterxml.jackson.databind.JsonNode getNode(Object root, String path)
root - path - public static boolean nodeExists(Object json, String path)
root - path - Copyright © 2014. All Rights Reserved.