JSONValue Class

Used to represent a value associated with a key in a JSONObject or an entry in a JSONArray. The value can be converted into a number of Java primitives (strings, integers, doubles, booleans, etc).

Constructors

JSONValue( Object value )

Public Methods

toString( ) returns String
Returns the value as a string. Returns null if the string is null or empty or if there was a problem converting the value to a string.
toJSONObject( ) returns JSONObject
Returns the value as a JSONObject. Returns a null if there was a problem converting the value to an JSONObject or if the value is null.
toJSONArray( ) returns JSONArray
Returns the value as a JSONArray. Returns a null if there was a problem converting the value to an JSONArray or if the value is null.
get( int i ) returns JSONValue
Returns the value associated with an index in a JSONArray, assuming the underlying object represented by this class is a JSONArray. This is shorthand for value.toJSONArray().get(i);
get( String key ) returns JSONValue
Returns the value associated with a key in a JSONObject, assuming the underlying object represented by this class is a JSONObject. This is shorthand for value.toJSONObject().get(key);