public class JSONObject extends JSONValue
Constructor and Description |
---|
JSONObject() |
JSONObject(JavaScriptObject jsValue)
Creates a new JSONObject from the supplied JavaScript value.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(String key)
Tests whether or not this JSONObject contains the specified property.
|
boolean |
equals(Object other)
|
JSONValue |
get(String key)
Gets the JSONValue associated with the specified property.
|
JavaScriptObject |
getJavaScriptObject()
Returns the underlying JavaScript object that this object wraps.
|
int |
hashCode() |
JSONObject |
isObject()
Returns
this , as this is a JSONObject. |
Set<String> |
keySet()
Returns the set of properties defined on this JSONObject.
|
JSONValue |
put(String key,
JSONValue jsonValue)
Assign the specified property to the specified value in this JSONObject.
|
int |
size()
Determines the number of properties on this object.
|
String |
toString()
Converts a JSONObject into a JSON representation that can be used to
communicate with a JSON service.
|
public JSONObject()
public JSONObject(JavaScriptObject jsValue)
public boolean containsKey(String key)
key
- the property to search fortrue
if the JSONObject contains the specified propertypublic JSONValue get(String key)
key
- the property to accessnull
if the
property does not existNullPointerException
- if key is null
public JavaScriptObject getJavaScriptObject()
public JSONObject isObject()
this
, as this is a JSONObject.public Set<String> keySet()
public JSONValue put(String key, JSONValue jsonValue)
key
- the property to assignjsonValue
- the value to assignnull
if the
property did not existNullPointerException
- if key is null
public int size()
Copyright © 2018. All rights reserved.