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的学习理解)