Package net.minidev.json
Class JSONArray
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<Object>,Collection<Object>,List<Object>,RandomAccess,JSONAware,JSONAwareEx,JSONStreamAware,JSONStreamAwareEx
public class JSONArray
extends ArrayList<Object>
implements List<Object>, JSONAwareEx, JSONStreamAwareEx
A JSON array. JSONObject supports java.util.List interface.
- See Also:
-
Field Summary
FieldsFields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidExplicitely Serialize Object as JSon Stringstatic StringtoJSONString(List<? extends Object> list) static StringtoJSONString(List<? extends Object> list, JSONStyle compression) Convert a list to JSON text.toJSONString(JSONStyle compression) toString()Override natif toStirng()JSONAwareEx inferfacevoidwrite JSON string to out.voidwriteJSONString(Appendable out, JSONStyle compression) write JSON string to out.static voidwriteJSONString(Iterable<? extends Object> list, Appendable out, JSONStyle compression) Encode a list into JSON text and write it to out.static voidwriteJSONString(List<? extends Object> list, 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, trimToSizeMethods inherited from class java.util.AbstractList
equals, hashCodeMethods inherited from class java.util.AbstractCollection
containsAllMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, streamMethods 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 Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
JSONArray
public JSONArray()
-
-
Method Details
-
toJSONString
-
toJSONString
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:
-
writeJSONString
public static void writeJSONString(Iterable<? extends Object> list, Appendable out, JSONStyle compression) throws 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:
IOException- See Also:
-
writeJSONString
- Throws:
IOException
-
merge
-
toJSONString
Explicitely Serialize Object as JSon String- Specified by:
toJSONStringin interfaceJSONAware- Returns:
- JSON text
-
toJSONString
- Specified by:
toJSONStringin interfaceJSONAwareEx- Returns:
- JSON text
-
toString
Override natif toStirng()- Overrides:
toStringin classAbstractCollection<Object>
-
toString
JSONAwareEx inferface- Parameters:
compression- compression param
-
writeJSONString
Description copied from interface:JSONStreamAwarewrite JSON string to out.- Specified by:
writeJSONStringin interfaceJSONStreamAware- Throws:
IOException
-
writeJSONString
Description copied from interface:JSONStreamAwareExwrite JSON string to out.- Specified by:
writeJSONStringin interfaceJSONStreamAwareEx- Throws:
IOException
-