例子一:
Strings="{"person":{"name":"张三","age":20}}";
JSONObject jsonObj =newJSONObject(s);
JSONObject result =jsonObj.getJSONObject("person");System.out.println("姓名:"+result.getString("name")+"年龄:"+result.getInt("age"));
//解析object形式
s="{"persons":["张三","李四","王五"]}";
jsonObj=newJSONObject(s);JSONArray;
jsonarr=jsonObj.getJSONArray("persons");for(inti=0;i