详将JSONObject与JSONArray
2016-07-11 23:21
513 查看
JsonObject说白了就是一个键值对,JSINArray就使用(“[ ] ”)中括号括起了很多个键值对,就是一个数组里面有很多个键值对。
1.处理JSONObject与JSONArray
Strng string= “poid”:
String str = null;
JSONObject jsonObject = new JSONObject();
JSONArray json = new JSONArray();
jsonObject = jsonObject.fromObject(string);
System.out.println(jsonObject.get("pois"));
json = JSONArray.fromObject(jsonObject.get("pois"));
System.out.println(jsonObject.toString());
for (int i = 0; i < json.toArray().length; i++)
{
jsonObject = json.getJSONObject(i);
}
1.处理JSONObject与JSONArray
Strng string= “poid”:
String str = null;
JSONObject jsonObject = new JSONObject();
JSONArray json = new JSONArray();
jsonObject = jsonObject.fromObject(string);
System.out.println(jsonObject.get("pois"));
json = JSONArray.fromObject(jsonObject.get("pois"));
System.out.println(jsonObject.toString());
for (int i = 0; i < json.toArray().length; i++)
{
jsonObject = json.getJSONObject(i);
}
相关文章推荐
- 使用 Python 处理 JSON 格式的数据
- XML 与 JSON 优劣对比
- VBA将excel数据表生成JSON文件
- newtonsoft.json解析天气数据出错解决方法
- vbs 解析json jsonp的方法
- Ruby和Ruby on Rails中解析JSON格式数据的实例教程
- Extjs4如何处理后台json数据中日期和时间
- C#实现将类的内容写成JSON格式字符串的方法
- JQuery ajax返回JSON时的处理方式 (三种方式)
- jquery JSON的解析方式示例介绍
- c#版json数据解析示例分享
- ASP JSON类文件的使用方法
- C# JSON格式化转换辅助类 ConvertJson
- C#实现对Json字符串处理实例
- C#实现Json转Unicode的方法
- php解析json数据实例
- PHP中JSON的应用技巧
- PHP6 先修班 JSON实例代码
- 关于JSON以及JSON在PHP中的应用技巧
- .Net中的json操作类用法分析