JSON的学习理解
Posted gentspy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JSON的学习理解相关的知识,希望对你有一定的参考价值。
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的学习理解的主要内容,如果未能解决你的问题,请参考以下文章