com.extjs.gxt.ui.client.js
Class JsonConverter

java.lang.Object
  extended by com.extjs.gxt.ui.client.js.JsonConverter

public class JsonConverter
extends java.lang.Object

Helper class to decode and encode objects to and from Json. Converter handles simple data types (strings, numbers, booleans) and lists and maps.


Constructor Summary
JsonConverter()
           
 
Method Summary
static java.util.Map<java.lang.String,java.lang.Object> decode(com.google.gwt.json.client.JSONObject jso)
          Decodes a JSONObject to a map.
static java.util.Map<java.lang.String,java.lang.Object> decode(java.lang.String jsonString)
          Decodes a Json string into a map.
protected static java.util.List<java.lang.Object> decodeToList(com.google.gwt.json.client.JSONArray array)
           
protected static java.lang.Object decodeValue(java.lang.String value)
           
static com.google.gwt.json.client.JSONObject encode(java.util.Map<java.lang.String,java.lang.Object> map)
          Encodes a map into a JSONObject.
static com.google.gwt.json.client.JSONObject encode(ModelData model)
          Encodes a model data instance into a JSONObject.
protected static com.google.gwt.json.client.JSONArray encodeList(java.util.List<java.lang.Object> data)
           
protected static com.google.gwt.json.client.JSONObject encodeMap(java.util.Map<java.lang.String,java.lang.Object> data)
           
protected static java.lang.String encodeValue(java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonConverter

public JsonConverter()
Method Detail

decode

public static java.util.Map<java.lang.String,java.lang.Object> decode(java.lang.String jsonString)
Decodes a Json string into a map.

Parameters:
jsonString - the Json string
Returns:
the map

decode

public static java.util.Map<java.lang.String,java.lang.Object> decode(com.google.gwt.json.client.JSONObject jso)
Decodes a JSONObject to a map.

Parameters:
jso - the JSONObject
Returns:
the map

encode

public static com.google.gwt.json.client.JSONObject encode(java.util.Map<java.lang.String,java.lang.Object> map)
Encodes a map into a JSONObject.

Parameters:
map - the map
Returns:
the JSONObject

encode

public static com.google.gwt.json.client.JSONObject encode(ModelData model)
Encodes a model data instance into a JSONObject.

Parameters:
model - the model data object
Returns:
the JSONObject

decodeValue

protected static java.lang.Object decodeValue(java.lang.String value)

decodeToList

protected static java.util.List<java.lang.Object> decodeToList(com.google.gwt.json.client.JSONArray array)

encodeValue

protected static java.lang.String encodeValue(java.lang.Object value)

encodeMap

protected static com.google.gwt.json.client.JSONObject encodeMap(java.util.Map<java.lang.String,java.lang.Object> data)

encodeList

protected static com.google.gwt.json.client.JSONArray encodeList(java.util.List<java.lang.Object> data)