org.json.simple
类 JSONObject
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap
org.json.simple.JSONObject
- 所有已实现的接口:
- java.io.Serializable, java.lang.Cloneable, java.util.Map, JSONAware, JSONStreamAware
public class JSONObject
- extends java.util.HashMap
- implements java.util.Map, JSONAware, JSONStreamAware
A JSON object. Key value pairs are unordered. JSONObject supports java.util.Map interface.
- 作者:
- FangYidong
- 另请参见:
- 序列化表格
从类 java.util.AbstractMap 继承的嵌套类/接口 |
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
从接口 java.util.Map 继承的嵌套类/接口 |
java.util.Map.Entry<K,V> |
方法摘要 |
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. |
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. |
从类 java.util.HashMap 继承的方法 |
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
从类 java.util.AbstractMap 继承的方法 |
equals, hashCode |
从类 java.lang.Object 继承的方法 |
finalize, getClass, notify, notifyAll, wait, wait, wait |
从接口 java.util.Map 继承的方法 |
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
JSONObject
public JSONObject()
JSONObject
public JSONObject(java.util.Map map)
- Allows creation of a JSONObject from a Map. After that, both the
generated JSONObject and the Map can be modified independently.
- 参数:
map
-
writeJSONString
public static void writeJSONString(java.util.Map map,
java.io.Writer out)
throws java.io.IOException
- Encode a map into JSON text and write it to out.
If this map is also a JSONAware or JSONStreamAware, JSONAware or JSONStreamAware specific behaviours will be ignored at this top level.
- 参数:
map
- out
-
- 抛出:
java.io.IOException
- 另请参见:
JSONValue.writeJSONString(Object, Writer)
writeJSONString
public void writeJSONString(java.io.Writer out)
throws java.io.IOException
- 从接口
JSONStreamAware
复制的描述
- write JSON string to out.
- 指定者:
- 接口
JSONStreamAware
中的 writeJSONString
- 抛出:
java.io.IOException
toJSONString
public static java.lang.String toJSONString(java.util.Map map)
- Convert a map to JSON text. The result is a JSON object.
If this map is also a JSONAware, JSONAware specific behaviours will be omitted at this top level.
- 参数:
map
-
- 返回:
- JSON text, or "null" if map is null.
- 另请参见:
JSONValue.toJSONString(Object)
toJSONString
public java.lang.String toJSONString()
- 指定者:
- 接口
JSONAware
中的 toJSONString
- 返回:
- JSON text
toString
public java.lang.String toString()
- 覆盖:
- 类
java.util.AbstractMap
中的 toString
toString
public static java.lang.String toString(java.lang.String key,
java.lang.Object value)
escape
public 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).
It's the same as JSONValue.escape() only for compatibility here.
- 参数:
s
-
- 返回:
- 另请参见:
JSONValue.escape(String)
Copyright © 2012. All Rights Reserved.