我正在尝试解析httpResponse
返回的以下JSON字符串:
{ "message" : "List of top ten checkin Men.",
"success" : "True",
"top_ten_checkin_men" : [ { "City_name" : "Mumbai",
"is_block" : "no",
"is_favorite" : "no",
"is_friend" : "no",
"last_step_in" : "Pride Hotels",
"online" : "1",
"points" : "3800",
"request_pending" : "no",
"user_thumbphoto" : "",
"userage" : "26",
"userbodytype" : "3",
"userfname" : "John",
"usergender" : "Male",
"userid" : "191",
"userlname" : "Aarmani",
"userlookingfor" : "Female",
"useronlinestatus" : "Yes",
"userphoto" : ""
},
{ "City_name" : "New York",
"is_block" : "no",
"is_favorite" : "no",
"is_friend" : "no",
"last_step_in" : "The House of MG",
"online" : "1",
"points" : "4450",
"request_pending" : "no",
"user_thumbphoto" : "http://anburaj.com/lockme/uploads/users/188/thumb_121840970.jpg",
"userage" : "31",
"userbodytype" : "3",
"userfname" : "Williams",
"usergender" : "Male",
"userid" : "188",
"userlname" : "Johens",
"userlookingfor" : "Female",
"useronlinestatus" : "Yes",
"userphoto" : "http://anburaj.com/lockme/uploads/users/188/121840970.jpg"
}
]
}
等等。
我应该为jsonarray
采取什么以及jsonobject
应该采取什么措施?
答案 0 :(得分:3)
答案 1 :(得分:1)
“[]”表示数组,“{}”表示对象
答案 2 :(得分:1)
这里有一个JSONObject
,其中包含成功和消息字段以及JSONArray
top_ten_checkin_men
类似于:
JSONObject json = new JSONObject(yourString);
String message = json.getString("message");
String success = json.getString("success");
JSONArray array = json.getJSONArray("top_ten_checkin_men");
应该做你想做的事情