public class JSONDeserializer extends Object
Constructor | Description |
---|---|
JSONDeserializer() |
Modifier and Type | Method | Description |
---|---|---|
static <T> T |
deserializeObject(Class<T> expectedType,
String json) |
Deserialize JSON to a new object graph, with the root object of the specified expected type.
|
static <T> T |
deserializeObject(Class<T> expectedType,
String json,
ClassFieldCache classFieldCache) |
Deserialize JSON to a new object graph, with the root object of the specified expected type, using or reusing
the given type cache.
|
static void |
deserializeToField(Object containingObject,
String fieldName,
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(Object containingObject,
String fieldName,
String 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(Class<T> expectedType, String json, ClassFieldCache classFieldCache) throws IllegalArgumentException
expectedType
- The type that the JSON should conform to.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.IllegalArgumentException
- If anything goes wrong during deserialization.public static <T> T deserializeObject(Class<T> expectedType, String json) throws IllegalArgumentException
expectedType
- The type that the JSON should conform to.json
- the JSON string to deserialize.IllegalArgumentException
- If anything goes wrong during deserialization.public static void deserializeToField(Object containingObject, String fieldName, String json, ClassFieldCache classFieldCache) throws 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.IllegalArgumentException
- If anything goes wrong during deserialization.public static void deserializeToField(Object containingObject, String fieldName, String json) throws 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.IllegalArgumentException
- If anything goes wrong during deserialization.Copyright © 2018. All rights reserved.