public class JSONObject extends HashMap implements Map, JSONAware, JSONStreamAware
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| 构造器和说明 |
|---|
JSONObject() |
JSONObject(Map map)
Allows creation of a JSONObject from a Map.
|
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
escape(String s)
Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F).
|
Object |
get(String key) |
BigDecimal |
getBigDecimal(String key)
Get the BigDecimal value associated with a key.
|
BigInteger |
getBigInteger(String key)
Get the BigInteger value associated with a key.
|
boolean |
getBoolean(String key)
Get the boolean value associated with a key.
|
double |
getDouble(String key)
Get the double value associated with a key.
|
int |
getInt(String key) |
JSONArray |
getJSONArray(String key) |
JSONObject |
getJSONObject(String key) |
long |
getLong(String key) |
String |
getString(String key) |
JSONObject |
put(Object key,
Object value) |
JSONObject |
put(String key,
Object value) |
static String |
quote(String string) |
static Writer |
quote(String string,
Writer w) |
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, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesequals, hashCodeclear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuespublic JSONObject()
public JSONObject(Map map)
map - public JSONObject put(String key, Object value)
public Object get(String key) throws JSONException
JSONExceptionpublic String getString(String key) throws JSONException
JSONExceptionpublic int getInt(String key) throws JSONException
JSONExceptionpublic boolean getBoolean(String key) throws JSONException
key - A key string.JSONException - if the value is not a Boolean or the String "true" or
"false".public BigInteger getBigInteger(String key) throws JSONException
key - A key string.JSONException - if the key is not found or if the value cannot
be converted to BigInteger.public BigDecimal getBigDecimal(String key) throws JSONException
key - A key string.JSONException - if the key is not found or if the value
cannot be converted to BigDecimal.public double getDouble(String key) throws JSONException
key - A key string.JSONException - if the key is not found or if the value is not a Number
object and cannot be converted to a number.public JSONArray getJSONArray(String key) throws JSONException
JSONExceptionpublic JSONObject getJSONObject(String key) throws JSONException
JSONExceptionpublic long getLong(String key) throws JSONException
JSONExceptionpublic static Writer quote(String string, Writer w) throws IOException
IOExceptionpublic static void writeJSONString(Map map, Writer out) throws IOException
map - out - IOExceptionblade.kit.json2.JSONValue#writeJSONString(Object, Writer)public void writeJSONString(Writer out) throws IOException
JSONStreamAwarewriteJSONString 在接口中 JSONStreamAwareIOExceptionpublic static String toJSONString(Map map)
map - blade.kit.json2.JSONValue#toJSONString(Object)public String toJSONString()
toJSONString 在接口中 JSONAwarepublic String toString()
toString 在类中 AbstractMapCopyright © 2015. All rights reserved.