org.json - JSONArray
JSONArray 是值的有序序列。它提供按索引访问值和放置值的方法。支持以下类型 −
Boolean
JSONArray
JSONObject
Number
String
JSONObject.NULL 对象
示例
import org.json.JSONArray;
import org.json.JSONObject;
public class JSONDemo {
public static void main(String[] args) {
JSONArray list = new JSONArray();
list.put("foo");
list.put(new Integer(100));
list.put(new Double(1000.21));
list.put(new Boolean(true));
list.put(JSONObject.NULL);
System.out.println("JSONArray: ");
System.out.println(list);
}
}
输出
JSONArray: ["foo",100,1000.21,true,null]

