/*
* Ext GWT - Ext for GWT
* Copyright(c) 2007-2009, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
//package com.extjs.gxt.ui.client.js;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.extjs.gxt.ui.client.core.FastMap;
import com.extjs.gxt.ui.client.data.ModelData;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONBoolean;
import com.google.gwt.json.client.JSONNull;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
/**
* Helper class to decode and encode objects to and from Json. Converter handles
* simple data types (strings, numbers, booleans) and lists and maps.
*/
public class JsonConverter {
/**
* Decodes a Json string into a map.
*
* @param jsonString the Json string
* @return the map
*/
public static Map decode(String jsonString) {
JSONValue v = JSONParser.parse(jsonString);
if (v.isObject() != null) {
return decode(v.isObject());
} else {
return null;
}
}
/**
* Decodes a JSONObject to a map.
*
* @param jso the JSONObject
* @return the map
*/
public static Map decode(JSONObject jso) {
Map map = new FastMap