public final class Json extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Json.ParseException
Json parser runtime exception.
|
static class |
Json.RawValue
An object that can be used to render raw String value,
i.e. a String that will not be wrapped in quotes.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
fromJson(com.fasterxml.jackson.databind.JsonNode json,
Class<T> clazz)
Convert a JsonNode to a Java value
|
static <T> T |
fromJson(String json,
Class<T> clazz)
Convert a JsonNode to a Java value
|
static <T> T |
fromJson(String json,
com.fasterxml.jackson.databind.JavaType type)
Convert a string to a Java value
|
static boolean |
isValid(String json)
verifies a valid json string
|
static com.fasterxml.jackson.databind.node.ObjectNode |
newObject()
Creates a new empty ObjectNode.
|
static com.fasterxml.jackson.databind.JsonNode |
parse(String jsonString)
Parse a String representing a json, and return it as a JsonNode.
|
static String |
stringify(com.fasterxml.jackson.databind.JsonNode json)
Convert a JsonNode to its string representation.
|
static String |
stringify(Object data)
Convert an object to a json string representation.
|
static com.fasterxml.jackson.databind.JsonNode |
toJson(Object data)
Convert an object to JsonNode.
|
public static com.fasterxml.jackson.databind.JsonNode toJson(Object data)
data - Value to convert in Json.Json.ParseException - to runtime if object can't be parsedpublic static <T> T fromJson(com.fasterxml.jackson.databind.JsonNode json,
Class<T> clazz)
T - type of return objectjson - Json value to convert.clazz - Expected Java value type.Json.ParseException - to runtime if json node can't be casted to clazz.public static <T> T fromJson(String json, com.fasterxml.jackson.databind.JavaType type)
T - type of return objectjson - Json value to convert.type - Expected Java value type.Json.ParseException - to runtime if json node can't be casted to clazz.public static <T> T fromJson(String json, Class<T> clazz)
T - type of return objectjson - Json value to convert.clazz - Expected Java value type.public static com.fasterxml.jackson.databind.node.ObjectNode newObject()
public static String stringify(com.fasterxml.jackson.databind.JsonNode json)
json - The json object to toJsonStringpublic static String stringify(Object data)
data - The data object to toJsonStringpublic static boolean isValid(String json)
json - The json stringpublic static com.fasterxml.jackson.databind.JsonNode parse(String jsonString)
jsonString - string to parseJson.ParseException - to runtime if json string can't be parsedCopyright © 2014. All Rights Reserved.