2个回答
展开全部
你这个JSON格式,就是数组里面放数组,所以是,取JSON对象》取JSON数组data》取JSON数组。
import java.util.ArrayList;import java.util.Iterator;import net.sf.json.*;public class MainClass {/*** @param args*/public static void main(String[] args) {JSONObject jsonObj = JSONObject.fromObject(JsonData.getData());JSONArray jsonArr = jsonObj.getJSONArray("data");Iterator<JSONArray> itr = jsonArr.iterator();JSONArray temp;while(itr.hasNext()) {temp = itr.next();System.out.println("===========Each JSONArray=========");for(int i = 0; i<temp.size(); i++) {System.out.println(temp.get(i));}}}private static class JsonData {private static String getData() {return "{\"data\":[[5000235,2,3441,8,17,\"北京测试\",\"10000101111\",\"\",\"\",\"100001\",\"\",\"2011-09-23 17:20:07\",18,\"vhcDefaultPwd\",1,0,\"2011-09-20 00:00:00\",12,0,380,\"测试\",213,1,0,0,0,0,0,\"2012-11-05 14:35:23\",\"\"],[5000236,27,3442,10,17,\"北京测试2\",\"1230000\",\"\",\"\",\"2010920002\",\"111111\",\"2011-09-23 17:20:08\",18,\"vhcDefaultPwd\",1,0,\"2011-09-20 00:00:00\",12,0,380,\"测试2\",213,1,0,0,0,0,0,\"2012-11-05 14:35:23\",\"\"]]}";}}}
import java.util.ArrayList;import java.util.Iterator;import net.sf.json.*;public class MainClass {/*** @param args*/public static void main(String[] args) {JSONObject jsonObj = JSONObject.fromObject(JsonData.getData());JSONArray jsonArr = jsonObj.getJSONArray("data");Iterator<JSONArray> itr = jsonArr.iterator();JSONArray temp;while(itr.hasNext()) {temp = itr.next();System.out.println("===========Each JSONArray=========");for(int i = 0; i<temp.size(); i++) {System.out.println(temp.get(i));}}}private static class JsonData {private static String getData() {return "{\"data\":[[5000235,2,3441,8,17,\"北京测试\",\"10000101111\",\"\",\"\",\"100001\",\"\",\"2011-09-23 17:20:07\",18,\"vhcDefaultPwd\",1,0,\"2011-09-20 00:00:00\",12,0,380,\"测试\",213,1,0,0,0,0,0,\"2012-11-05 14:35:23\",\"\"],[5000236,27,3442,10,17,\"北京测试2\",\"1230000\",\"\",\"\",\"2010920002\",\"111111\",\"2011-09-23 17:20:08\",18,\"vhcDefaultPwd\",1,0,\"2011-09-20 00:00:00\",12,0,380,\"测试2\",213,1,0,0,0,0,0,\"2012-11-05 14:35:23\",\"\"]]}";}}}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询