我想解析这些 Json 响应:
{
"MyResponse": {
"count": 3,
"listTsm": [{
"id": "b90c6218-73c8-30bd-b532-5ccf435da766",
"simpleid": 1,
"name": "vignesh1"
},
{
"id": "b90c6218-73c8-30bd-b532-5ccf435da766",
"simpleid": 2,
"name": "vignesh2"
},
{
"id": "b90c6218-73c8-30bd-b532-5ccf435da766",
"simpleid": 3,
"name": "vignesh3"
}]
}
}
我尝试使用 SIMPLE JSON 解析器,但这对我不起作用:
Object obj = parser.parse(resp);
JSONObject jsonObject = (JSONObject) obj;
JSONArray response = (JSONArray) jsonObject.get("MyResponse");
//JSONArray arr=new JSONArray(yourJSONresponse);
ArrayList<String> list = new ArrayList<String>();
for(int i=0; i<response.size(); i++){
list.add(response.get(i)("name"));
}