01: /*
02: * $Id: JSONArray.java,v 1.1 2006/04/15 14:10:48 platform Exp $
03: * Created on 2006-4-10
04: */
05: package org.zkforge.json.simple;
06:
07: import java.util.ArrayList;
08: import java.util.Iterator;
09:
10: /**
11: * @author FangYidong<fangyidong@yahoo.com.cn>
12: */
13: public class JSONArray extends ArrayList {
14: public String toString() {
15: ItemList list = new ItemList();
16:
17: Iterator iter = iterator();
18:
19: while (iter.hasNext()) {
20: Object value = iter.next();
21: if (value instanceof String) {
22: list.add("\"" + JSONObject.escape((String) value)
23: + "\"");
24: } else
25: list.add(String.valueOf(value));
26: }
27: return "[" + list.toString() + "]";
28: }
29:
30: }
|