public class JSONObject extends java.util.HashMap implements java.util.Map, JSONAware, JSONStreamAware
| Constructor and Description |
|---|
JSONObject() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
toJSONString()
Returns a JSON string representing this object.
|
static java.lang.String |
toJSONString(java.util.Map map)
Convert a map to JSON text.
|
java.lang.String |
toString()
Returns a string representation of this object.
|
static java.lang.String |
toString(java.lang.String key,
java.lang.Object value)
Returns a JSON string fragment containing the key and 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)
Writes a JSON string representing this object instance to the specified
output writer.
|
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuespublic JSONObject()
public static void writeJSONString(java.util.Map map, java.io.Writer out) throws java.io.IOException
JSONAware or JSONStreamAware,
JSONAware or JSONStreamAware specific
behaviours will be ignored at this top level.map - the map to write (null permitted).out - the output writer (null not permitted).java.io.IOException - if there is an I/O problem.JSONValue.writeJSONString(Object, Writer)public void writeJSONString(java.io.Writer out) throws java.io.IOException
writeJSONString in interface JSONStreamAwareout - the output writer (null not permitted).java.io.IOException - if there is an I/O problem.public static java.lang.String toJSONString(java.util.Map map)
JSONAware, JSONAware specific
behaviours will be omitted at this top level.map - the map (null permitted).JSONValue.toJSONString(Object)public java.lang.String toJSONString()
toJSONString in interface JSONAwarepublic java.lang.String toString()
toString in class java.util.AbstractMappublic static java.lang.String toString(java.lang.String key, java.lang.Object value)
key - the key (null permitted).value - the value (null permitted).