Package org.json.simple

# Class JSONArray

java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
java.util.ArrayList
org.json.simple.JSONArray

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `Iterable`, `Collection`, `List`, `RandomAccess`, `SequencedCollection`, `JSONAware`, `JSONStreamAware`

@Deprecated public class JSONArray extends ArrayList implements JSONAware, JSONStreamAware
Deprecated.
since 2.0.0, replaced by `JsonArray`
A JSON array. JSONObject supports java.util.List interface.

Author:
  FangYidong<fangyidong@yahoo.com.cn>
See Also:
  - Serialized Form

## Field Summary

### Fields inherited from class java.util.AbstractList

`modCount`

## Constructor Summary

Constructors
Constructor
Description
`JSONArray()`
Deprecated.
Constructs an empty JSONArray.
`JSONArray(Collection c)`
Deprecated.
Constructs a JSONArray containing the elements of the specified collection, in the order they are returned by the collection's iterator.

## Method Summary

Modifier and Type
Method
Description
`String`
`toJSONString()`
Deprecated.
`static String`
`toJSONString(boolean[] array)`
Deprecated.
description omitted.
`static String`
`toJSONString(byte[] array)`
Deprecated.
description omitted.
`static String`
`toJSONString(char[] array)`
Deprecated.
description omitted.
`static String`
`toJSONString(double[] array)`
Deprecated.
description omitted.
`static String`
`toJSONString(float[] array)`
Deprecated.
description omitted.
`static String`
`toJSONString(int[] array)`
Deprecated.
description omitted.
`static String`
`toJSONString(long[] array)`
Deprecated.
description omitted.
`static String`
`toJSONString(short[] array)`
Deprecated.
description omitted.
`static String`
`toJSONString(Object[] array)`
Deprecated.
description omitted.
`static String`
`toJSONString(Collection collection)`
Deprecated.
Convert a list to JSON text.
`String`
`toString()`
Deprecated.
Returns a string representation of this array.
`static void`
`writeJSONString(boolean[] array, Writer out)`
Deprecated.
description omitted.
`static void`
`writeJSONString(byte[] array, Writer out)`
Deprecated.
description omitted.
`static void`
`writeJSONString(char[] array, Writer out)`
Deprecated.
description omitted.
`static void`
`writeJSONString(double[] array, Writer out)`
Deprecated.
description omitted.
`static void`
`writeJSONString(float[] array, Writer out)`
Deprecated.
description omitted.
`static void`
`writeJSONString(int[] array, Writer out)`
Deprecated.
description omitted.
`static void`
`writeJSONString(long[] array, Writer out)`
Deprecated.
description omitted.
`static void`
`writeJSONString(short[] array, Writer out)`
Deprecated.
description omitted.
`void`
`writeJSONString(Writer out)`
Deprecated.
write JSON string to out.
`static void`
`writeJSONString(Object[] array, Writer out)`
Deprecated.
description omitted.
`static void`
`writeJSONString(Collection collection, Writer out)`
Deprecated.
Encode a list into JSON text and write it to out.

### Methods inherited from class java.util.ArrayList

`add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize`

### Methods inherited from class java.util.AbstractCollection

`containsAll`

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.util.Collection

`parallelStream, stream, toArray`

### Methods inherited from interface java.util.List

`containsAll, reversed`

## Constructor Details

### JSONArray

public JSONArray()
Deprecated.
Constructs an empty JSONArray.

### JSONArray

public JSONArray(Collection c)
Deprecated.
Constructs a JSONArray containing the elements of the specified collection, in the order they are returned by the collection's iterator.

Parameters:
  `c` - the collection whose elements are to be placed into this JSONArray

## Method Details

### writeJSONString

public static void writeJSONString(Collection collection, Writer out) throws IOException
Deprecated.
Encode a list into JSON text and write it to out. If this list is also a JSONStreamAware or a JSONAware, JSONStreamAware and JSONAware specific behaviours will be ignored at this top level.

Parameters:
  `collection` - description omitted.
  `out` - description omitted.
Throws:
  `IOException` - description omitted.
See Also:
  - `JSONValue.writeJSONString(Object, Writer)`

### writeJSONString

public void writeJSONString(Writer out) throws IOException
Deprecated.
Description copied from interface: `JSONStreamAware`
write JSON string to out.

Specified by:
  `writeJSONString` in interface `JSONStreamAware`
Parameters:
  `out` - description omitted.
Throws:
  `IOException` - description omitted.

### toJSONString

public static String toJSONString(Collection collection)
Deprecated.
Convert a list to JSON text. The result is a JSON array. If this list is also a JSONAware, JSONAware specific behaviours will be omitted at this top level.

Parameters:
  `collection` - description omitted.
Returns:
  JSON text, or "null" if list is null.
See Also:
  - `JSONValue.toJSONString(Object)`

### writeJSONString

public static void writeJSONString(byte[] array, Writer out) throws IOException
Deprecated.
description omitted.

Parameters:
  `array` - description omitted.
  `out` - description omitted.
Throws:
  `IOException` - description omitted.

### toJSONString

public static String toJSONString(byte[] array)
Deprecated.
description omitted.

Parameters:
  `array` - description omitted.
Returns:
  description omitted.

### writeJSONString

public static void writeJSONString(short[] array, Writer out) throws IOException
Deprecated.
description omitted.

Parameters:
  `array` - description omitted.
  `out` - description omitted.
Throws:
  `IOException` - description omitted.

### toJSONString

public static String toJSONString(short[] array)
Deprecated.
description omitted.

Parameters:
  `array` - description omitted.
Returns:
  description omitted.

### writeJSONString

public static void writeJSONString(int[] array, Writer out) throws IOException
Deprecated.
description omitted.

Parameters:
  `array` - description omitted.
  `out` - description omitted.
Throws:
  `IOException` - description omitted.

### toJSONString

public static String toJSONString(int[] array)
Deprecated.
description omitted.

Parameters:
  `array` - description omitted.
Returns:
  description omitted.

### writeJSONString

public static void writeJSONString(long[] array, Writer out) throws IOException
Deprecated.
description omitted.

Parameters:
  `array` - description omitted.
  `out` - description omitted.
Throws:
  `IOException` - description omitted.

### toJSONString

public static String toJSONString(long[] array)
Deprecated.
description omitted.

Parameters:
  `array` - description omitted.
Returns:
  description omitted.

### writeJSONString

public static void writeJSONString(float[] array, Writer out) throws IOException
Deprecated.
description omitted.

Parameters:
  `array` - description omitted.
  `out` - description omitted.
Throws:
  `IOException` - description omitted.

### toJSONString

public static String toJSONString(float[] array)
Deprecated.
description omitted.

Parameters:
  `array` - description omitted.
Returns:
  description omitted.

### writeJSONString

public static void writeJSONString(double[] array, Writer out) throws IOException
Deprecated.
description omitted.

Parameters:
  `array` - description omitted.
  `out` - description omitted.
Throws:
  `IOException` - description omitted.

### toJSONString

public static String toJSONString(double[] array)
Deprecated.
description omitted.

Parameters:
  `array` - description omitted.
Returns:
  description omitted.

### writeJSONString

public static void writeJSONString(boolean[] array, Writer out) throws IOException
Deprecated.
description omitted.

Parameters:
  `array` - description omitted.
  `out` - description omitted.
Throws:
  `IOException` - description omitted.

### toJSONString

public static String toJSONString(boolean[] array)
Deprecated.
description omitted.

Parameters:
  `array` - description omitted.
Returns:
  description omitted.

### writeJSONString

public static void writeJSONString(char[] array, Writer out) throws IOException
Deprecated.
description omitted.

Parameters:
  `array` - description omitted.
  `out` - description omitted.
Throws:
  `IOException` - description omitted.

### toJSONString

public static String toJSONString(char[] array)
Deprecated.
description omitted.

Parameters:
  `array` - description omitted.
Returns:
  description omitted.

### writeJSONString

public static void writeJSONString(Object[] array, Writer out) throws IOException
Deprecated.
description omitted.

Parameters:
  `array` - description omitted.
  `out` - description omitted.
Throws:
  `IOException` - description omitted.

### toJSONString

public static String toJSONString(Object[] array)
Deprecated.
description omitted.

Parameters:
  `array` - description omitted.
Returns:
  description omitted.

### toJSONString

public String toJSONString()
Deprecated.

Specified by:
  `toJSONString` in interface `JSONAware`
Returns:
  JSON text

### toString

public String toString()
Deprecated.
Returns a string representation of this array. This is equivalent to calling `toJSONString()`.

Overrides:
  `toString` in class `AbstractCollection`