Android 读取 json 数据(遍历jsonarray和jsonboject)-FenGKun
来源:互联网 发布:淘宝怎么完成实名认证 编辑:程序博客网 时间:2024/04/30 07:03
Android 读取 json 数据(遍历jsonarray和jsonboject)
public String getJson(){ String jsonString = "{\"FLAG\":\"flag\",\"MESSAGE\":\"SUCCESS\",\"name\":[{\"name\":\"jack\"},{\"name\":\"lucy\"}]}";//json字符串 try { JSONObject result = new JSONObject(jsonstring);//转换为JSONObject int num = result.length(); JSONArray nameList = result.getJSONArray("name");//获取JSONArray int length = nameList.length(); String aa = ""; for(int i = 0; i < length; i++){//遍历JSONArray Log.d("debugTest",Integer.toString(i)); JSONObject oj = nameList.getJSONObject(i); aa = aa + oj.getString("name")+"|"; } Iterator<?> it = result.keys(); String aa2 = ""; String bb2 = null; while(it.hasNext()){//遍历JSONObject bb2 = (String) it.next().toString(); aa2 = aa2 + result.getString(bb2); } return aa; } catch (JSONException e) { throw new RuntimeException(e); } }
1 0
- Android 读取 json 数据(遍历jsonarray和jsonboject)-FenGKun
- android 读取JSON数据(遍历JSONObject和JSONArray)
- android 读取JSON数据(遍历JSONObject和JSONArray) .
- android 读取json数据(遍历JSONObject和JSONArray)
- android 读取json数据(遍历JSONObject和JSONArray)
- android 读取JSON数据(遍历JSONObject和JSONArray)
- android 读取json数据(遍历JSONObject和JSONArray
- android 读取json数据(遍历JSONObject和JSONArray
- JSON数据解析(JSONArray和JSONObject)
- Android JSON解析(JSONObject和JSONArray)
- Android JSON解析(JSONObject和JSONArray)
- Android中的JSONObject和JSONArray解析json数据
- android用JSONObject和JSONArray解析json格式数据
- 用JSONObject和JSONArray 解析json数据
- json 的解析-使用Android中的JSONObject和JSONArray解析json数据
- Android JSON 解析(一) JSONObject 和 JSONArray
- 简单易用的json解析,json生成器和基于JSONArray和JSONObject for Android的数据存储
- JSONObject,JSON,和JSONArray
- 利用java反射机制实现动态导出excel
- debian7配置apache+mysql+php
- Vision引擎中FXAA 后期处理器介绍
- 网络工程师之路
- 剑指offer系列源码-包含min函数的栈
- Android 读取 json 数据(遍历jsonarray和jsonboject)-FenGKun
- 常用正则表达式大全!(例如:匹配中文、匹配html)
- GetParent与GetOwner的区别
- About PCA
- 第13周项目 4 冒泡输出
- 关于高仿微信对话列表滑动删除效果代码优化
- 单链表的Python实现
- 条款19 了解临时对象的来源
- 批量删除和复选框