@Component public class JsonHelper extends Object
| Constructor and Description |
|---|
JsonHelper() |
| Modifier and Type | Method and Description |
|---|---|
String |
objectToJson(Object object)
Serializes any Java value as JSON output.
|
<T> T |
unmarshallJsonToObject(Class<T> classType,
String jsonContent)
Deserializes JSON content from given JSON content String.
|
public String objectToJson(Object object) throws IllegalStateException
object - the Java object to be serializedIllegalStateException - when an I/O error occurspublic <T> T unmarshallJsonToObject(Class<T> classType, String jsonContent) throws IOException
classType - the class type of the objectjsonContent - the JSON stringIOException - if there is an error in unmarshallingCopyright © 2017. All rights reserved.