Package net.minidev.json
Class JSONArray
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<java.lang.Object>
-
- net.minidev.json.JSONArray
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<java.lang.Object>
,java.util.Collection<java.lang.Object>
,java.util.List<java.lang.Object>
,java.util.RandomAccess
,JSONAware
,JSONAwareEx
,JSONStreamAware
,JSONStreamAwareEx
public class JSONArray extends java.util.ArrayList<java.lang.Object> implements java.util.List<java.lang.Object>, JSONAwareEx, JSONStreamAwareEx
A JSON array. JSONObject supports java.util.List interface.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description JSONArray()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
merge(java.lang.Object o2)
java.lang.String
toJSONString()
Explicitely Serialize Object as JSon Stringstatic java.lang.String
toJSONString(java.util.List<? extends java.lang.Object> list)
static java.lang.String
toJSONString(java.util.List<? extends java.lang.Object> list, JSONStyle compression)
Convert a list to JSON text.java.lang.String
toJSONString(JSONStyle compression)
java.lang.String
toString()
Override natif toStirng()java.lang.String
toString(JSONStyle compression)
JSONAwareEx inferfacevoid
writeJSONString(java.lang.Appendable out)
write JSON string to out.void
writeJSONString(java.lang.Appendable out, JSONStyle compression)
write JSON string to out.static void
writeJSONString(java.lang.Iterable<? extends java.lang.Object> list, java.lang.Appendable out, JSONStyle compression)
Encode a list into JSON text and write it to out.static void
writeJSONString(java.util.List<? extends java.lang.Object> list, java.lang.Appendable out)
-
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
Methods inherited from class java.lang.Object
finalize, 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, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
toJSONString
public static java.lang.String toJSONString(java.util.List<? extends java.lang.Object> list)
-
toJSONString
public static java.lang.String toJSONString(java.util.List<? extends java.lang.Object> list, JSONStyle compression)
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
-compression
- Indicate compression level- Returns:
- JSON text, or "null" if list is null.
- See Also:
JSONValue.toJSONString(Object)
-
writeJSONString
public static void writeJSONString(java.lang.Iterable<? extends java.lang.Object> list, java.lang.Appendable out, JSONStyle compression) 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, Appendable)
-
writeJSONString
public static void writeJSONString(java.util.List<? extends java.lang.Object> list, java.lang.Appendable out) throws java.io.IOException
- Throws:
java.io.IOException
-
merge
public void merge(java.lang.Object o2)
-
toJSONString
public java.lang.String toJSONString()
Explicitely Serialize Object as JSon String- Specified by:
toJSONString
in interfaceJSONAware
- Returns:
- JSON text
-
toJSONString
public java.lang.String toJSONString(JSONStyle compression)
- Specified by:
toJSONString
in interfaceJSONAwareEx
- Returns:
- JSON text
-
toString
public java.lang.String toString()
Override natif toStirng()- Overrides:
toString
in classjava.util.AbstractCollection<java.lang.Object>
-
toString
public java.lang.String toString(JSONStyle compression)
JSONAwareEx inferface- Parameters:
compression
- compression param
-
writeJSONString
public void writeJSONString(java.lang.Appendable out) throws java.io.IOException
Description copied from interface:JSONStreamAware
write JSON string to out.- Specified by:
writeJSONString
in interfaceJSONStreamAware
- Throws:
java.io.IOException
-
writeJSONString
public void writeJSONString(java.lang.Appendable out, JSONStyle compression) throws java.io.IOException
Description copied from interface:JSONStreamAwareEx
write JSON string to out.- Specified by:
writeJSONString
in interfaceJSONStreamAwareEx
- Throws:
java.io.IOException
-
-