org.xerial.json
Class JSONObject

java.lang.Object
  extended by org.xerial.json.JSONValueBase
      extended by org.xerial.json.JSONObject
All Implemented Interfaces:
JSONValue

public class JSONObject
extends JSONValueBase


Constructor Summary
JSONObject()
           
JSONObject(String jsonStr)
           
 
Method Summary
 int elementSize()
           
 JSONValue get(String key)
           
 int getInt(String key)
           
 JSONArray getJSONArray(String key)
           
 JSONObject getJSONObject()
           
 JSONObject getJSONObject(String key)
           
 Map<String,JSONValue> getKeyValueMap()
           
 String getString(String key)
           
 JSONValueType getValueType()
          Gets the JSON value type of this value
 boolean hasKey(String key)
           
 Set<String> keys()
           
static org.antlr.runtime.tree.CommonTree parse(String jsonStr)
           
 void put(String key, JSONValue obj)
           
 void put(String key, Object value)
           
 String toJSONString()
          Produces output of the JSON format of this value
 String toString()
           
 
Methods inherited from class org.xerial.json.JSONValueBase
getJSONArray, getJSONBoolean, getJSONNull, getJSONNumber, getJSONString, join, translateAsJSONValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JSONObject

public JSONObject()

JSONObject

public JSONObject(String jsonStr)
           throws JSONException
Throws:
JSONException
Method Detail

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


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