Share via


JSONArray Class

Definition

A dense indexed sequence of values.

[Android.Runtime.Register("org/json/JSONArray", DoNotGenerateAcw=true)]
public class JSONArray : Java.Lang.Object
[<Android.Runtime.Register("org/json/JSONArray", DoNotGenerateAcw=true)>]
type JSONArray = class
    inherit Object
Inheritance
JSONArray
Attributes

Remarks

A dense indexed sequence of values. Values may be any mix of JSONObject JSONObjects, other JSONArray JSONArrays, Strings, Booleans, Integers, Longs, Doubles, null or JSONObject#NULL. Values may not be Double#isNaN() NaNs, Double#isInfinite() infinities, or of any type not listed here.

JSONArray has the same type coercion behavior and optional/mandatory accessors as JSONObject. See that class' documentation for details.

<strong>Warning:</strong> this class represents null in two incompatible ways: the standard Java null reference, and the sentinel value JSONObject#NULL. In particular, get fails if the requested index holds the null reference, but succeeds if it holds JSONObject.NULL.

Instances of this class are not thread safe. Although this class is nonfinal, it was not designed for inheritance and should not be subclassed. In particular, self-use by overridable methods is not specified. See Effective Java Item 17, "Design and Document or inheritance or else prohibit it" for further information.

Java documentation for org.json.JSONArray.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

JSONArray()

Creates a JSONArray with no values.

JSONArray(ICollection)

Creates a new JSONArray by copying all values from the given collection.

JSONArray(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

JSONArray(JSONTokener)

Creates a new JSONArray with values from the next array in the tokener.

JSONArray(Object)

Creates a new JSONArray with values from the given primitive array.

JSONArray(String)

Creates a new JSONArray with values from the JSON string.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
Get(Int32)

Returns the value at index.

GetBoolean(Int32)

Returns the value at index if it exists and is a boolean or can be coerced to a boolean.

GetDouble(Int32)

Returns the value at index if it exists and is a double or can be coerced to a double.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetInt(Int32)

Returns the value at index if it exists and is an int or can be coerced to an int.

GetJSONArray(Int32)

Returns the value at index if it exists and is a JSONArray.

GetJSONObject(Int32)

Returns the value at index if it exists and is a JSONObject.

GetLong(Int32)

Returns the value at index if it exists and is a long or can be coerced to a long.

GetString(Int32)

Returns the value at index if it exists, coercing it if necessary.

IsNull(Int32)

Returns true if this array has no value at index, or if its value is the null reference or JSONObject#NULL.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Join(String)

Returns a new string by alternating this array's values with separator.

Length()

Returns the number of values in this array.

Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
Opt(Int32)

Returns the value at index, or null if the array has no value at index.

OptBoolean(Int32, Boolean)

Returns the value at index if it exists and is a boolean or can be coerced to a boolean.

OptBoolean(Int32)

Returns the value at index if it exists and is a boolean or can be coerced to a boolean.

OptDouble(Int32, Double)

Returns the value at index if it exists and is a double or can be coerced to a double.

OptDouble(Int32)

Returns the value at index if it exists and is a double or can be coerced to a double.

OptInt(Int32, Int32)

Returns the value at index if it exists and is an int or can be coerced to an int.

OptInt(Int32)

Returns the value at index if it exists and is an int or can be coerced to an int.

OptJSONArray(Int32)

Returns the value at index if it exists and is a JSONArray.

OptJSONObject(Int32)

Returns the value at index if it exists and is a JSONObject.

OptLong(Int32, Int64)

Returns the value at index if it exists and is a long or can be coerced to a long.

OptLong(Int32)

Returns the value at index if it exists and is a long or can be coerced to a long.

OptString(Int32, String)

Returns the value at index if it exists, coercing it if necessary.

OptString(Int32)

Returns the value at index if it exists, coercing it if necessary.

Put(Boolean)

Appends value to the end of this array.

Put(Double)

Appends value to the end of this array.

Put(Int32, Boolean)

Sets the value at index to value, null padding this array to the required length if necessary.

Put(Int32, Double)

Sets the value at index to value, null padding this array to the required length if necessary.

Put(Int32, Int32)

Sets the value at index to value, null padding this array to the required length if necessary.

Put(Int32, Int64)

Sets the value at index to value, null padding this array to the required length if necessary.

Put(Int32, Object)

Sets the value at index to value, null padding this array to the required length if necessary.

Put(Int32)

Appends value to the end of this array.

Put(Int64)

Appends value to the end of this array.

Put(Object)

Appends value to the end of this array.

Remove(Int32)

Removes and returns the value at index, or null if the array has no value at index.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToJSONObject(JSONArray)

Returns a new object whose values are the values in this array, and whose names are the values in names.

ToString()

Returns a string representation of the object.

(Inherited from Object)
ToString(Int32)

Encodes this array as a human readable JSON string for debugging, such as:

UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to