01: /*
02: * GWT-Ext Widget Library
03: * Copyright(c) 2007-2008, GWT-Ext.
04: * licensing@gwt-ext.com
05: *
06: * http://www.gwt-ext.com/license
07: */
08: package com.gwtext.client.util;
09:
10: import com.google.gwt.core.client.JavaScriptObject;
11:
12: /**
13: * JSON Helper class.
14: */
15: public class JSON {
16:
17: private JSON() {
18: }
19:
20: /**
21: * Decodes (parses) a JSON string to an object. If the JSON is invalid, this function throws a SyntaxError.
22: *
23: * @param json the Json String
24: * @return the Json object
25: */
26: public static native JavaScriptObject decode(String json) /*-{
27: return $wnd.Ext.util.JSON.decode(json);
28: }-*/;
29:
30: /**
31: * Encodes a Json object.
32: *
33: * @param json the json object
34: * @return the JSon String
35: */
36: public static native String encode(JavaScriptObject json) /*-{
37: return $wnd.Ext.util.JSON.encode(json);
38: }-*/;
39: }
|