public class JsonGson
extends java.lang.Object
Constructor and Description |
---|
JsonGson() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
fromJson(java.lang.Class<?> clazz,
java.lang.String json)
Convert a json string ito an instance of the specified class.
|
static java.util.Map |
fromJson(java.lang.String source)
Convert the JSON string to a Map of Lists of Maps...
|
static java.util.Map[] |
fromJsonArray(java.lang.String source)
Convert a JSON string containing a json Array into an Array of Maps
|
static java.lang.Object |
fromMap(java.lang.Class<?> clazz,
java.util.Map map)
Convert the Map into an instance of the given class
|
static java.lang.String |
toJson(java.lang.Object obj)
Convert the object tree to JSON, including the $id.
|
static java.lang.String |
toJson(java.lang.Object obj,
boolean includesBreezeEntities,
boolean isHibernate)
Convert the object tree to JSON
|
public static java.lang.String toJson(java.lang.Object obj)
obj
- The obj to serialize to jsonpublic static java.lang.String toJson(java.lang.Object obj, boolean includesBreezeEntities, boolean isHibernate)
obj
- The root object to be serialized to json.includesBreezeEntities
- Whether to add the $id and $ref and $type properties when serializing the object.public static java.util.Map fromJson(java.lang.String source)
source
- A json stringpublic static java.util.Map[] fromJsonArray(java.lang.String source)
source
- A string containing a json array i.e. "[....]".public static java.lang.Object fromMap(java.lang.Class<?> clazz, java.util.Map map)
clazz
- The class to deserialize into.map
- The data to deserialize.public static java.lang.Object fromJson(java.lang.Class<?> clazz, java.lang.String json)
clazz
- The class to deserialize into.json
- The data to deserialize.