赞
踩
String object = "{'main':[{'name':'A','address':'ShanHai'},{'name':'B','address':'ShanHai'},{'name':'C','address':'ShanHai'},{'name':'D','address':'ShanHai'}]}";
JSONObject jsonObject = JSONObject.fromObject(object);
System.out.println(jsonObject);
List sbulist = jsonObject.getJSONArray("main").subList(0, 3);
System.out.println(sbulist);
jsonObject.put("main", sbulist);
System.out.println(jsonObject);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。