- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap
-
- org.jooq.tools.json.JSONObject
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Map
public class JSONObject extends HashMap
A JSON object. Key value pairs are unordered. JSONObject supports java.util.Map interface.- Author:
- FangYidong<fangyidong@yahoo.com.cn>
- See Also:
- Serialized Form
-
-
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 Constructor Description JSONObject()
JSONObject(Map map)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
escape(String s)
Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F).static String
toJSONString(Map<?,?> map)
Convert a map to JSON text.String
toString()
static String
toString(String key, Object value)
static void
writeJSONString(Map<?,?> map, Writer out)
Encode a map into JSON text and write it to out.-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Methods inherited from class java.util.AbstractMap
equals, hashCode
-
-
-
-
Constructor Detail
-
JSONObject
public JSONObject()
-
JSONObject
public JSONObject(Map map)
-
-
Method Detail
-
writeJSONString
public static void writeJSONString(Map<?,?> map, Writer out) throws IOException
Encode a map into JSON text and write it to out.- Throws:
IOException
- See Also:
JSONValue.writeJSONString(Object, Writer)
-
toJSONString
public static String toJSONString(Map<?,?> map)
Convert a map to JSON text. The result is a JSON object.- Returns:
- JSON text, or "null" if map is null.
- See Also:
JSONValue.toJSONString(Object)
-
toString
public String toString()
- Overrides:
toString
in classAbstractMap
-
escape
public static String escape(String s)
Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F). It's the same as JSONValue.escape() only for compatibility here.- See Also:
JSONValue.escape(String)
-
-