Appends value
to the array already mapped to name
.
Appends values to the array mapped to name
.
Begins encoding a new array.
private void
Inserts any necessary separators and whitespace before a name.
private void
Inserts any necessary separators and whitespace before a literal value,
inline array, or inline object.
(package private) static double
Returns the input if it is a JSON-permissible value; throws otherwise.
(package private) void
Closes the current scope by appending any necessary whitespace and the
given bracket.
protected void
Ends encoding the current array.
Ends encoding the current object.
Returns the value at index
.
Returns the value mapped by name
, or throws if no such mapping exists.
boolean
Returns the value at index
if it exists and is a boolean or can
be coerced to a boolean.
boolean
Returns the value mapped by name
if it exists and is a boolean or
can be coerced to a boolean, or throws otherwise.
double
Returns the value at index
if it exists and is a double or can
be coerced to a double.
double
Returns the value mapped by name
if it exists and is a double or
can be coerced to a double, or throws otherwise.
int
Returns the value at index
if it exists and is an int or
can be coerced to an int.
int
Returns the value mapped by name
if it exists and is an int or
can be coerced to an int, or throws otherwise.
Returns the value at index
if it exists and is a
JSONArray
.
Returns the value mapped by name
if it exists and is a
JSONArray
, or throws otherwise.
Returns the value at index
if it exists and is a
JSONObject
.
Returns the value mapped by name
if it exists and is a
JSONObject
, or throws otherwise.
long
Returns the value at index
if it exists and is a long or
can be coerced to a long.
long
Returns the value mapped by name
if it exists and is a long or
can be coerced to a long, or throws otherwise.
Returns the value at index
if it exists, coercing it if
necessary.
Returns the value mapped by name
if it exists, coercing it if
necessary, or throws if no such mapping exists.
Returns a new string by alternating this array's values with
separator
.
Encodes the key (property name) to this stringer.
char
Returns the next available character if it equals c
.
JSONTokener.next(int length)
Returns the next length
characters of the input.
char
Returns the next character that is not whitespace and does not belong to
a comment.
private int
Returns the string up to but not including quote
, unescaping any
character escape sequences encountered along the way.
Returns the next value from the input.
Encodes the number as a JSON string.
Begins encoding a new object.
Creates a name-value map from a bean
Enters a new scope by appending any necessary whitespace and the given
bracket.
Returns the value on the top of the stack.
JSONArray.put(double value)
Appends value
to the end of this array.
JSONArray.put(int index,
boolean value)
Sets the value at index
to value
, null padding this array
to the required length if necessary.
JSONArray.put(int index,
double value)
Sets the value at index
to value
, null padding this array
to the required length if necessary.
JSONArray.put(int index,
int value)
Sets the value at index
to value
, null padding this array
to the required length if necessary.
JSONArray.put(int index,
long value)
Sets the value at index
to value
, null padding this array
to the required length if necessary.
Sets the value at index
to value
, null padding this array
to the required length if necessary.
Sets the value at
index
to
value
wrapped into
JSONArray
,
null padding this array to the required length if necessary.
Maps name
to value
, clobbering any existing name/value
mapping with the same name.
Maps name
to value
, clobbering any existing name/value
mapping with the same name.
Maps name
to value
, clobbering any existing name/value
mapping with the same name.
Maps name
to value
, clobbering any existing name/value
mapping with the same name.
Maps name
to value
, clobbering any existing name/value
mapping with the same name.
Equivalent to put(name, value)
when both parameters are non-null;
does nothing otherwise.
Reads a sequence of values and the trailing closing brace ']' of an
array.
private char
Unescapes the character identified by the character or characters that
immediately follow a backslash.
Reads a null, boolean, numeric or unquoted string literal value.
Reads a sequence of key/value pairs and the trailing closing brace '}' of
an object.
Returns an array with the values corresponding to names
.
Returns a new object whose values are the values in this array, and whose
names are the values in names
.
Encodes this array as a human readable JSON string for debugging, such
as:
Encodes this object as a human readable JSON string for debugging, such
as:
JSONStringer.value(boolean value)
Encodes value
to this stringer.
JSONStringer.value(double value)
Encodes value
to this stringer.
JSONStringer.value(long value)
Encodes value
to this stringer.