public class JsonSerializer
extends java.lang.Object
Field annotations| Constructor and Description | 
|---|
JsonSerializer()  | 
| Modifier and Type | Method and Description | 
|---|---|
<T> T | 
fromJson(com.badlogic.gdx.files.FileHandle fileHandle,
        java.lang.Class<T> clazz)
Reads a JSON document and converts it into an object of the specified
 type 
 | 
<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> void | 
toJson(com.badlogic.gdx.files.FileHandle fileHandle,
      T object)
Writes a JSON document by searching the object for
  
Field annotations | 
<T> void | 
toJson(com.badlogic.gdx.files.FileHandle fileHandle,
      T object,
      boolean prettyPrint)
Writes a JSON document by searching the object for
  
Field annotations | 
<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(com.badlogic.gdx.files.FileHandle fileHandle,
             java.lang.Class<T> clazz)
           throws SerializationException
fileHandle - The FileHandle for the JSON documentclazz - The Class to convert the document toSerializationException - Thrown when the data is invalidpublic <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> void toJson(com.badlogic.gdx.files.FileHandle fileHandle,
              T object)
            throws SerializationException
Field annotationsfileHandle - The FileHandle to write toobject - The object to convert to JSONSerializationException - Thrown when the object is invalidpublic <T> void toJson(com.badlogic.gdx.files.FileHandle fileHandle,
              T object,
              boolean prettyPrint)
            throws SerializationException
Field annotationsfileHandle - The FileHandle to write toobject - The object to convert to JSONprettyPrint - Set to true if the JSON should be prettifiedSerializationException - Thrown when the object 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