org.xerial.json
Class JSONObject
java.lang.Object
org.xerial.json.JSONValueBase
org.xerial.json.JSONObject
- All Implemented Interfaces:
- JSONValue
public class JSONObject
- extends JSONValueBase
JSONObject
public JSONObject()
JSONObject
public JSONObject(String jsonStr)
throws JSONException
- Throws:
JSONException
parse
public static org.antlr.runtime.tree.CommonTree parse(String jsonStr)
throws JSONException
- Throws:
JSONException
put
public void put(String key,
JSONValue obj)
put
public void put(String key,
Object value)
throws JSONException
- Throws:
JSONException
toString
public String toString()
- Overrides:
toString in class Object
toJSONString
public String toJSONString()
- Description copied from interface:
JSONValue
- Produces output of the JSON format of this value
- Specified by:
toJSONString in interface JSONValue- Overrides:
toJSONString in class JSONValueBase
- Returns:
- the JSON output
elementSize
public int elementSize()
get
public JSONValue get(String key)
keys
public Set<String> keys()
getInt
public int getInt(String key)
throws JSONException
- Throws:
JSONException
getString
public String getString(String key)
throws JSONException
- Throws:
JSONException
getJSONObject
public JSONObject getJSONObject()
- Specified by:
getJSONObject in interface JSONValue- Overrides:
getJSONObject in class JSONValueBase
- Returns:
- JSONObject representation of this object if this instance is a JSONSObject, otherwise null
getJSONArray
public JSONArray getJSONArray(String key)
hasKey
public boolean hasKey(String key)
getKeyValueMap
public Map<String,JSONValue> getKeyValueMap()
getJSONObject
public JSONObject getJSONObject(String key)
throws JSONException
- Throws:
JSONException
getValueType
public JSONValueType getValueType()
- Description copied from interface:
JSONValue
- Gets the JSON value type of this value
- Returns:
- the
JSONValueType

This work is licensed under a Creative Commons Attribution-ShareAlike 2.1 Japan License.