public class JSONObject extends java.util.HashMap implements java.util.Map, JSONAware, JSONStreamAware
| Modifier and Type | Field and Description |
|---|---|
private static long |
serialVersionUID |
| Constructor and Description |
|---|
JSONObject() |
JSONObject(java.util.Map map)
Allows creation of a JSONObject from a Map.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
escape(java.lang.String s)
Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F).
|
java.lang.String |
toJSONString() |
static java.lang.String |
toJSONString(java.util.Map map)
Convert a map to JSON text.
|
private static java.lang.String |
toJSONString(java.lang.String key,
java.lang.Object value,
java.lang.StringBuffer sb) |
java.lang.String |
toString() |
static java.lang.String |
toString(java.lang.String key,
java.lang.Object value) |
static void |
writeJSONString(java.util.Map map,
java.io.Writer out)
Encode a map into JSON text and write it to out.
|
void |
writeJSONString(java.io.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, valuesprivate static final long serialVersionUID
public JSONObject()
public JSONObject(java.util.Map map)
map - public static void writeJSONString(java.util.Map map,
java.io.Writer out)
throws java.io.IOException
map - out - java.io.IOExceptionJSONValue.writeJSONString(Object, Writer)public void writeJSONString(java.io.Writer out)
throws java.io.IOException
JSONStreamAwarewriteJSONString in interface JSONStreamAwarejava.io.IOExceptionpublic static java.lang.String toJSONString(java.util.Map map)
map - JSONValue.toJSONString(Object)public java.lang.String toJSONString()
toJSONString in interface JSONAwareprivate static java.lang.String toJSONString(java.lang.String key,
java.lang.Object value,
java.lang.StringBuffer sb)
public java.lang.String toString()
toString in class java.util.AbstractMappublic static java.lang.String toString(java.lang.String key,
java.lang.Object value)
public static java.lang.String escape(java.lang.String s)
s - JSONValue.escape(String)