public class JSONUtil extends Object
Modifier and Type | Method and Description |
---|---|
static org.codehaus.jackson.map.ObjectMapper |
getJsonMapper() |
static String |
toJSON(Object object)
Converting object to JSON string.
|
static <T> T |
toObject(String value,
Class<T> klazz)
Convert string representation to object.
|
static <T> T |
toObject(String value,
org.codehaus.jackson.map.type.CollectionType collectionType) |
static <T> T |
toObject(String value,
org.codehaus.jackson.type.TypeReference<T> typeReference) |
public static String toJSON(Object object) throws IOException
object
- The object to convert.IOException
- IO issuesSwiftJsonMarshallingException
- failure to generate JSONpublic static <T> T toObject(String value, Class<T> klazz) throws IOException
value
- The JSON string.klazz
- The class to convert.IOException
public static <T> T toObject(String value, org.codehaus.jackson.type.TypeReference<T> typeReference) throws IOException
T
- typevalue
- json stringtypeReference
- class type referenceIOException
public static <T> T toObject(String value, org.codehaus.jackson.map.type.CollectionType collectionType) throws IOException
T
- typevalue
- json stringcollectionType
- class describing how to deserialize collection of objectsIOException
public static org.codehaus.jackson.map.ObjectMapper getJsonMapper()
Copyright © 2017 Apache Software Foundation. All Rights Reserved.