public class JsonUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <T> T |
fromString(java.lang.String string,
java.lang.Class<T> clazz)
Returns an object corresponding to the specified JSON string
|
static <T> T |
fromString(java.lang.String string,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
Use if you need a collection of things to be converted from a json string like a List or Set
|
static java.lang.String |
toString(java.lang.Object object)
Returns a JSON string representation of the specified object
|
public static java.lang.String toString(java.lang.Object object) throws DxlException
object
- The object to convert to a JSON stringDxlException
- If a DXL exception occurspublic static <T> T fromString(java.lang.String string, java.lang.Class<T> clazz) throws DxlException
T
- The object typestring
- The JSON stringclazz
- The object typeDxlException
- If a DXL exception occurspublic static <T> T fromString(java.lang.String string, com.fasterxml.jackson.core.type.TypeReference<T> typeReference) throws DxlException
T
- The object typestring
- The JSON stringtypeReference
- TypeReferenceDxlException
- If a DXL exception occurs