码迷,mamicode.com
首页 > Web开发 > 详细

JSON的学习理解

时间:2016-03-06 19:13:08      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:

JSON 轻量级的数据交换语言
JSON:{“name”:“zs”,"age":20,"gender":"m","aihao":["0","a","."],"married":false,"school":{”name":"tarena","loc":"bj"}};

String str={“name”:“zs”,"age":20,"gender":"m","aihao":["0","a","."],"married":false,"school":{”name":"tarena","loc":"bj"}};

JSONObject obj=new JSONObject(str);
String name=obj.getString("name");
int age=obj.getInt("age");
boolean m=obj.getBoolean("married");
JSONArray ary=obj.getJSONArray("aihao");
JSONObject o2=obj.getJSONOjbject("school");
02.getString("name");
obj.getJSONObject("school").getString("loc");

JSON的学习理解

标签:

原文地址:http://www.cnblogs.com/gentspy/p/5248039.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!