Class JSONArray

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.lang.Object>, java.util.Collection<java.lang.Object>, java.util.Deque<java.lang.Object>, java.util.List<java.lang.Object>, java.util.Queue<java.lang.Object>, JSONAware

    public class JSONArray
    extends java.util.LinkedList<java.lang.Object>
    implements java.util.List<java.lang.Object>, JSONAware
    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()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String toJSONString()
      Encodes this object to a JSON string.
      static java.lang.String toJSONString​(boolean[] ary)
      Convert a boolean array to JSON text.
      static java.lang.String toJSONString​(byte[] ary)
      Convert a byte array to JSON text.
      static java.lang.String toJSONString​(char[] ary)
      Convert a char array to JSON text.
      static java.lang.String toJSONString​(double[] ary)
      Convert a double array to JSON text.
      static java.lang.String toJSONString​(float[] ary)
      Convert a float array to JSON text.
      static java.lang.String toJSONString​(int[] ary)
      Convert an integer array to JSON text.
      static java.lang.String toJSONString​(long[] ary)
      Convert a long array to JSON text.
      static java.lang.String toJSONString​(short[] ary)
      Convert a short array to JSON text.
      static java.lang.String toJSONString​(java.lang.Object[] ary)
      Convert an object array to JSON text.
      static java.lang.String toJSONString​(java.util.Collection collection)
      Convert a list to JSON text.
      java.lang.String toString()
      Encodes this object to a JSON string.
      • Methods inherited from class java.util.LinkedList

        add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, spliterator, toArray, toArray
      • Methods inherited from class java.util.AbstractSequentialList

        iterator
      • Methods inherited from class java.util.AbstractList

        equals, hashCode, listIterator, removeRange, subList
      • Methods inherited from class java.util.AbstractCollection

        containsAll, isEmpty, removeAll, retainAll
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.util.Deque

        iterator
      • Methods inherited from interface java.lang.Iterable

        forEach
      • 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, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
    • Constructor Detail

      • JSONArray

        public JSONArray()
    • Method Detail

      • toJSONString

        public static java.lang.String toJSONString​(java.util.Collection collection)
        Convert a list to JSON text. The result is a JSON array. If this list is also a JSONAware, JSONAware specific behaviors will be omitted at this top level.
        Parameters:
        collection -
        Returns:
        JSON text, or "null" if list is null.
        See Also:
        JSONValue.toJSONString(Object)
      • toJSONString

        public static java.lang.String toJSONString​(java.lang.Object[] ary)
        Convert an object array to JSON text.

        patched by tomyeh

      • toJSONString

        public static java.lang.String toJSONString​(int[] ary)
        Convert an integer array to JSON text.

        patched by tomyeh

      • toJSONString

        public static java.lang.String toJSONString​(long[] ary)
        Convert a long array to JSON text.

        patched by tomyeh

      • toJSONString

        public static java.lang.String toJSONString​(short[] ary)
        Convert a short array to JSON text.

        patched by tomyeh

      • toJSONString

        public static java.lang.String toJSONString​(float[] ary)
        Convert a float array to JSON text.

        patched by tomyeh

      • toJSONString

        public static java.lang.String toJSONString​(double[] ary)
        Convert a double array to JSON text.

        patched by tomyeh

      • toJSONString

        public static java.lang.String toJSONString​(byte[] ary)
        Convert a byte array to JSON text.

        patched by tomyeh

      • toJSONString

        public static java.lang.String toJSONString​(boolean[] ary)
        Convert a boolean array to JSON text.

        patched by tomyeh

      • toJSONString

        public static java.lang.String toJSONString​(char[] ary)
        Convert a char array to JSON text.

        patched by tomyeh

      • toJSONString

        public java.lang.String toJSONString()
        Encodes this object to a JSON string. It is the same as toString().
        Specified by:
        toJSONString in interface JSONAware
        Returns:
        JSON text
      • toString

        public java.lang.String toString()
        Encodes this object to a JSON string. It is the same as toJSONString().
        Overrides:
        toString in class java.util.AbstractCollection<java.lang.Object>