Class JSONArray

All Implemented Interfaces:
Serializable, Cloneable, Iterable<Object>, Collection<Object>, Deque<Object>, List<Object>, Queue<Object>, JSONAware

public class JSONArray extends LinkedList<Object> implements List<Object>, JSONAware
A JSON array. JSONObject supports java.util.List interface.
Author:
FangYidong<fangyidong@yahoo.com.cn>
See Also:
  • Constructor Details

    • JSONArray

      public JSONArray()
  • Method Details

    • toJSONString

      public static String toJSONString(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:
    • toJSONString

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

      patched by tomyeh

    • toJSONString

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

      patched by tomyeh

    • toJSONString

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

      patched by tomyeh

    • toJSONString

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

      patched by tomyeh

    • toJSONString

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

      patched by tomyeh

    • toJSONString

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

      patched by tomyeh

    • toJSONString

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

      patched by tomyeh

    • toJSONString

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

      patched by tomyeh

    • toJSONString

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

      patched by tomyeh

    • toJSONString

      public 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 String toString()
      Encodes this object to a JSON string. It is the same as toJSONString().
      Overrides:
      toString in class AbstractCollection<Object>