public class JsonSerializer
extends java.lang.Object
Field
annotationsConstructor and Description |
---|
JsonSerializer() |
Modifier and Type | Method and Description |
---|---|
<T> T |
fromJson(java.lang.String json,
java.lang.Class<T> clazz)
Reads a JSON document and converts it into an object of the specified type
|
<T> java.lang.String |
toJson(T object)
Writes a JSON document by searching the object for
Field annotations |
<T> java.lang.String |
toJson(T object,
boolean prettyPrint)
Writes a JSON document by searching the object for
Field annotations |
public <T> T fromJson(java.lang.String json, java.lang.Class<T> clazz) throws SerializationException
json
- The JSON documentclazz
- The Class
to convert the document toSerializationException
- Thrown when the data is invalidpublic <T> java.lang.String toJson(T object) throws SerializationException
Field
annotationsobject
- The object to convert to JSONSerializationException
- Thrown when the object is invalidpublic <T> java.lang.String toJson(T object, boolean prettyPrint) throws SerializationException
Field
annotationsobject
- The object to convert to JSONprettyPrint
- Set to true if the JSON should be prettifiedSerializationException
- Thrown when the object is invalid