public class JSONObject extends HashMap implements Map, JSONAware, JSONStreamAware
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
JSONObject() |
JSONObject(Map map)
Allows creation of a JSONObject from a Map.
|
Modifier and Type | Method and Description |
---|---|
static String |
escape(String s)
Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F).
|
String |
toJSONString() |
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.
|
void |
writeJSONString(Writer out)
write JSON string to out.
|
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
equals, hashCode
finalize, getClass, notify, notifyAll, wait, wait, wait
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
public JSONObject()
public JSONObject(Map map)
map
- all content of json objectpublic static void writeJSONString(Map map, Writer out) throws IOException
map
- all content of jsonout
- where json should be writeIOException
- if can't write content into writerJSONValue.writeJSONString(Object, Writer)
public void writeJSONString(Writer out) throws IOException
JSONStreamAware
writeJSONString
in interface JSONStreamAware
out
- the writer of jsonIOException
- if something gone wrongpublic static String toJSONString(Map map)
map
- all content of jsonJSONValue.toJSONString(Object)
public String toJSONString()
toJSONString
in interface JSONAware
public String toString()
toString
in class AbstractMap
public static String escape(String s)
s
- the string to escapeJSONValue.escape(String)