Package org.zkoss.json
Class JSONObject
public class JSONObject
extends LinkedHashMap<Object,Object>
implements Map<Object,Object>, JSONAware
A JSON object. Key value pairs are in the order of adding.
JSONObject supports java.util.Map interface.
- Author:
- FangYidong<fangyidong@yahoo.com.cn>
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, valuesMethods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from class java.util.AbstractMap
equals, hashCodeMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Constructor Details
-
JSONObject
public JSONObject()
-
-
Method Details
-
toJSONString
Convert (aka., encode) a map to JSON text. The result is a JSON object. If this map is also a JSONAware, JSONAware specific behaviors will be omitted at this top level.- Parameters:
map-- Returns:
- JSON text, or "null" if map is null.
- See Also:
-
toJSONString
Encodes this object to a JSON string. It is the same astoString().- Specified by:
toJSONStringin interfaceJSONAware- Returns:
- JSON text
-
toString
Encodes this object to a JSON string. It is the same astoJSONString().- Overrides:
toStringin classAbstractMap<Object,Object>
-
toString
-