怎么解析json数组数据?求帮忙,百度好久了都不行。 json 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 JSONObject obj = new JSONObject(json);JSONArray array = obj.getJSONArray("list"); String json = new String("{\"result\":\"SUCCESS\",\"list\":[{\"copyrightcontent\":\"copyright\",\"copyrightid\":1,\"copyrightname\":\"knsemimodaviewcontroller\"}]}"); JSONObject jsonObj = new JSONObject(json); List<Model> list = new ArrayList<MainActivity.Model>(); String result = jsonObj.getString("result"); System.out.println("result = " + result); if("SUCCESS".equals(result)){ JSONArray jsonArray = jsonObj.getJSONArray("list"); for(int i = 0; i<jsonArray.length(); i++){ JSONObject obj = jsonArray.getJSONObject(i); String copyRightContent = obj.getString("copyrightcontent"); String copyRightId = obj.getString("copyrightid"); String copyRightName = obj.getString("copyrightname"); list.add(new Model(copyRightContent, copyRightId, copyRightName)); System.out.println(list.get(i)); } } 求解决发布调用问题 关于 ant 打包,build.xml配置的 android.package.excludes 问题 android获取屏幕宽高的问题 android 经典问题 请问大家android2.2能否播放flv视频 android 控件 点击放大,关闭,缩小到原来大小 android ndk listview删除行数据 warning:xml has more than 80 views, bad for performance的问题 MyEclipse安装ADT 安卓多久能独立开发整个项目 spinner弹出框设为半透明
JSONArray array = obj.getJSONArray("list");
JSONObject jsonObj = new JSONObject(json);
List<Model> list = new ArrayList<MainActivity.Model>();
String result = jsonObj.getString("result");
System.out.println("result = " + result);
if("SUCCESS".equals(result)){
JSONArray jsonArray = jsonObj.getJSONArray("list");
for(int i = 0; i<jsonArray.length(); i++){
JSONObject obj = jsonArray.getJSONObject(i);
String copyRightContent = obj.getString("copyrightcontent");
String copyRightId = obj.getString("copyrightid");
String copyRightName = obj.getString("copyrightname");
list.add(new Model(copyRightContent, copyRightId, copyRightName));
System.out.println(list.get(i));
}
}