org.json.simple
Class JSONArray

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList
              extended by org.json.simple.JSONArray
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.RandomAccess, JSONAware, JSONStreamAware

public class JSONArray
extends java.util.ArrayList
implements java.util.List, JSONAware, JSONStreamAware

A JSON array. JSONObject supports java.util.List interface.

Author:
FangYidong
See Also:
Serialized Form

Constructor Summary
JSONArray()
           
 
Method Summary
 java.lang.String toJSONString()
           
static java.lang.String toJSONString(java.util.List list)
          Convert a list to JSON text.
 java.lang.String toString()
           
static void writeJSONString(java.util.List list, java.io.Writer out)
          Encode a list into JSON text and write it to out.
 void writeJSONString(java.io.Writer out)
          write JSON string to out.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
 

Constructor Detail

JSONArray

public JSONArray()
Method Detail

writeJSONString

public static void writeJSONString(java.util.List list,
                                   java.io.Writer out)
                            throws java.io.IOException
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:
list -
out -
Throws:
java.io.IOException
See Also:
JSONValue.writeJSONString(Object, Writer)

writeJSONString

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

Specified by:
writeJSONString in interface JSONStreamAware
Throws:
java.io.IOException

toJSONString

public static java.lang.String toJSONString(java.util.List list)
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:
list -
Returns:
JSON text, or "null" if list is null.
See Also:
JSONValue.toJSONString(Object)

toJSONString

public java.lang.String toJSONString()
Specified by:
toJSONString in interface JSONAware
Returns:
JSON text

toString

public java.lang.String toString()
Overrides:
toString in class java.util.AbstractCollection