org.zkoss.json
Class JSONObject

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,V>
          extended by java.util.LinkedHashMap<java.lang.Object,java.lang.Object>
              extended by org.zkoss.json.JSONObject
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>, JSONAware

public class JSONObject
extends java.util.LinkedHashMap<java.lang.Object,java.lang.Object>
implements java.util.Map<java.lang.Object,java.lang.Object>, JSONAware

A JSON object. Key value pairs are in the order of adding. JSONObject supports java.util.Map interface.

Author:
FangYidong
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
JSONObject()
           
 
Method Summary
 java.lang.String toJSONString()
          Encodes this object to a JSON string.
static java.lang.String toJSONString(java.util.Map map)
          Convert (aka., encode) a map to JSON text.
 java.lang.String toString()
          Encodes this object to a JSON string.
static java.lang.String toString(java.lang.String key, java.lang.Object value)
           
 
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, get, removeEldestEntry
 
Methods inherited from class java.util.HashMap
clone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Constructor Detail

JSONObject

public JSONObject()
Method Detail

toJSONString

public static java.lang.String toJSONString(java.util.Map map)
Convert (aka., encode) a map to JSON text. The result is a JSON object. If this map is also a JSONAware, JSONAware specific behaviours will be omitted at this top level.

Parameters:
map -
Returns:
JSON text, or "null" if map is null.
See Also:
JSONValue.toJSONString(Object)

toJSONString

public java.lang.String toJSONString()
Encodes this object to a JSON string. It is the same as toString().

Specified by:
toJSONString in interface JSONAware
Returns:
JSON text

toString

public java.lang.String toString()
Encodes this object to a JSON string. It is the same as toJSONString().

Overrides:
toString in class java.util.AbstractMap<java.lang.Object,java.lang.Object>

toString

public static java.lang.String toString(java.lang.String key,
                                        java.lang.Object value)


Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo