一、解析对象
1.不带对象名:
①格式:{"address":"北京市","id":"1001","name":"Tom"}
②解析方法:
JSONObject json = new JSONObject(jsoString);
person.setId(json.getInt("id"));
person.setName(json.getString("name"));
person.setAddress(json.getString("address"));
2.带对象名
①格式:{"person1":{"address":"北京市","id":"1001","name":"Tom"}}
②解析方法:
JSONObject json = new JSONObject(jsonString).getJSONObject("person1");
person.setId(json.getInt("id"));
person.setName(json.getString("name"));<