JSONArray

All Methods Instance Methods Concrete Methods  Modifier and Type Method and Description void clear()

Removes all of the elements from this JSONArray.

Object get(int index)

Get the object value associated with an index.

BigDecimal getBigDecimal(int index)

Get the BigDecimal value associated with an index.

BigInteger getBigInteger(int index)

Get the BigInteger value associated with an index.

boolean getBoolean(int index)

Get the boolean value associated with an index.

double getDouble(int index)

Get the double value associated with an index.

<E extends Enum<E>>
E
getEnum(Class<E> clazz, int index)

Get the enum value associated with an index.

float getFloat(int index)

Get the float value associated with a key.

int getInt(int index)

Get the int value associated with an index.

JSONArray getJSONArray(int index)

Get the JSONArray associated with an index.

JSONObject getJSONObject(int index)

Get the JSONObject associated with an index.

long getLong(int index)

Get the long value associated with an index.

Number getNumber(int index)

Get the Number value associated with a key.

String getString(int index)

Get the string associated with an index.

boolean isEmpty()

Check if JSONArray is empty.

boolean isNull(int index)

Determine if the value is null.

Iterator<Object> iterator()  String join(String separator)

Make a string from the contents of this JSONArray.

int length()

Get the number of elements in the JSONArray, included nulls.

Object opt(int index)

Get the optional object value associated with an index.

BigDecimal optBigDecimal(int index, BigDecimal defaultValue)

Get the optional BigDecimal value associated with an index.

BigInteger optBigInteger(int index, BigInteger defaultValue)

Get the optional BigInteger value associated with an index.

boolean optBoolean(int index)

Get the optional boolean value associated with an index.

boolean optBoolean(int index, boolean defaultValue)

Get the optional boolean value associated with an index.

double optDouble(int index)

Get the optional double value associated with an index.

double optDouble(int index, double defaultValue)

Get the optional double value associated with an index.

<E extends Enum<E>>
E
optEnum(Class<E> clazz, int index)

Get the enum value associated with a key.

<E extends Enum<E>>
E
optEnum(Class<E> clazz, int index, E defaultValue)

Get the enum value associated with a key.

float optFloat(int index)

Get the optional float value associated with an index.

float optFloat(int index, float defaultValue)

Get the optional float value associated with an index.

int optInt(int index)

Get the optional int value associated with an index.

int optInt(int index, int defaultValue)

Get the optional int value associated with an index.

JSONArray optJSONArray(int index)

Get the optional JSONArray associated with an index.

JSONObject optJSONObject(int index)

Get the optional JSONObject associated with an index.

long optLong(int index)

Get the optional long value associated with an index.

long optLong(int index, long defaultValue)

Get the optional long value associated with an index.

Number optNumber(int index)

Get an optional Number value associated with a key, or null if there is no such key or if the value is not a number.

Number optNumber(int index, Number defaultValue)

Get an optional Number value associated with a key, or the default if there is no such key or if the value is not a number.

Object optQuery(JSONPointer jsonPointer)

Queries and returns a value from this object using jsonPointer, or returns null if the query fails due to a missing key.

Object optQuery(String jsonPointer)

Queries and returns a value from this object using jsonPointer, or returns null if the query fails due to a missing key.

String optString(int index)

Get the optional string value associated with an index.

String optString(int index, String defaultValue)

Get the optional string associated with an index.

JSONArray put(boolean value)

Append a boolean value.

JSONArray put(Collection<?> value)

Put a value in the JSONArray, where the value will be a JSONArray which is produced from a Collection.

JSONArray put(double value)

Append a double value.

JSONArray put(float value)

Append a float value.

JSONArray put(int value)

Append an int value.

JSONArray put(int index, boolean value)

Put or replace a boolean value in the JSONArray.

JSONArray put(int index, Collection<?> value)

Put a value in the JSONArray, where the value will be a JSONArray which is produced from a Collection.

JSONArray put(int index, double value)

Put or replace a double value.

JSONArray put(int index, float value)

Put or replace a float value.

JSONArray put(int index, int value)

Put or replace an int value.

JSONArray put(int index, long value)

Put or replace a long value.

JSONArray put(int index, Map<?,?> value)

Put a value in the JSONArray, where the value will be a JSONObject that is produced from a Map.

JSONArray put(int index, Object value)

Put or replace an object value in the JSONArray.

JSONArray put(long value)

Append an long value.

JSONArray put(Map<?,?> value)

Put a value in the JSONArray, where the value will be a JSONObject which is produced from a Map.

JSONArray put(Object value)

Append an object value.

JSONArray putAll(Collection<?> collection)

Put a collection's elements in to the JSONArray.

JSONArray putAll(Iterable<?> iter)

Put an Iterable's elements in to the JSONArray.

JSONArray putAll(JSONArray array)

Put a JSONArray's elements in to the JSONArray.

JSONArray putAll(Object array)

Put an array's elements in to the JSONArray.

Object query(JSONPointer jsonPointer)

Uses a user initialized JSONPointer and tries to match it to an item within this JSONArray.

Object query(String jsonPointer)

Creates a JSONPointer using an initialization string and tries to match it to an item within this JSONArray.

Object remove(int index)

Remove an index and close the hole.

boolean similar(Object other)

Determine if two JSONArrays are similar.

JSONObject toJSONObject(JSONArray names)

Produce a JSONObject by combining a JSONArray of names with the values of this JSONArray.

List<Object> toList()

Returns a java.util.List containing all of the elements in this array.

String toString()

Make a JSON text of this JSONArray.

String toString(int indentFactor)

Make a pretty-printed JSON text of this JSONArray.

Writer write(Writer writer)

Write the contents of the JSONArray as JSON text to a writer.

Writer write(Writer writer, int indentFactor, int indent)

Write the contents of the JSONArray as JSON text to a writer.