public class JSON
extends java.lang.Object | Constructor and Description |
|---|
JSON() |
| Modifier and Type | Method and Description |
|---|---|
static com.google.gwt.core.client.JavaScriptObject | decode(java.lang.String jsonString) De-serialize an object from JSON. |
static java.lang.String | encode(com.google.gwt.core.client.JavaScriptObject object) Serialize an object as a JSON string. |
static java.lang.String | encode(com.google.gwt.core.client.JavaScriptObject object, JSONEncoder settings) Serialize an object as a JSON string. |
public static java.lang.String encode(com.google.gwt.core.client.JavaScriptObject object)
Automatically handles circular references - see circularReferenceMode.
Note that using the String produced by this API with JSON.decode will not successfully preserve dates. Use JSONEncoder.setDateFormat "dateConstructor" to have dates round-trip properly.
Because GWT does not support Java reflection, JSON encoding cannot discover the properties of an arbitrary Java POJO. The following objects are supported:
object - object to serializepublic static java.lang.String encode(com.google.gwt.core.client.JavaScriptObject object,
JSONEncoder settings) Automatically handles circular references - see circularReferenceMode.
Note that using the String produced by this API with JSON.decode will not successfully preserve dates. Use JSONEncoder.setDateFormat "dateConstructor" to have dates round-trip properly.
Because GWT does not support Java reflection, JSON encoding cannot discover the properties of an arbitrary Java POJO. The following objects are supported:
object - object to serializesettings - optional settings for encodingpublic static com.google.gwt.core.client.JavaScriptObject decode(java.lang.String jsonString)
jsonString - JSON data to be de-serialized