public class JSONDeserializer
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
deserializeObject(java.lang.Class<T> expectedType,
java.lang.String json)
Deserialize JSON to a new object graph, with the root object of the specified expected type.
|
static void |
deserializeToField(java.lang.Object containingObject,
java.lang.String fieldName,
java.lang.String json)
Deserialize JSON to a new object graph, with the root object of the specified expected type, and store the
root object in the named field of the given containing object.
|
static void |
deserializeToField(java.lang.Object containingObject,
java.lang.String fieldName,
java.lang.String json,
nonapi.io.github.classgraph.json.ClassFieldCache classFieldCache)
Deserialize JSON to a new object graph, with the root object of the specified expected type, and store the
root object in the named field of the given containing object.
|
public static <T> T deserializeObject(java.lang.Class<T> expectedType,
java.lang.String json)
throws java.lang.IllegalArgumentException
T - The type that the JSON should conform to.expectedType - The class reference for the type that the JSON should conform to.json - the JSON string to deserialize.java.lang.IllegalArgumentException - If anything goes wrong during deserialization.public static void deserializeToField(java.lang.Object containingObject,
java.lang.String fieldName,
java.lang.String json,
nonapi.io.github.classgraph.json.ClassFieldCache classFieldCache)
throws java.lang.IllegalArgumentException
containingObject - The object containing the named field to deserialize the object graph into.fieldName - The name of the field to set with the result.json - the JSON string to deserialize.classFieldCache - The class field cache. Reusing this cache will increase the speed if many JSON documents of the
same type need to be parsed.java.lang.IllegalArgumentException - If anything goes wrong during deserialization.public static void deserializeToField(java.lang.Object containingObject,
java.lang.String fieldName,
java.lang.String json)
throws java.lang.IllegalArgumentException
containingObject - The object containing the named field to deserialize the object graph into.fieldName - The name of the field to set with the result.json - the JSON string to deserialize.java.lang.IllegalArgumentException - If anything goes wrong during deserialization.