java简单JSON服务器
如何在安卓中解析这种类型的json:
{
"chatCircles": [{
"id": "59660c155d44f20b46eab438",
"name": "Hyderabad Circle",
"description": "Hyderabad"
}]
}
我已经试过了,但用户界面没有更新
try {
JSONArray chatCircleArray = response.getJSONArray("chatCircle");
for (int i = 0; i < chatCircleArray.length(); i++){
JSONObject geoFenceObject = chatCircleArray.getJSONObject(i);
circleId = geoFenceObject.getString("id");
String circleName = geoFenceObject.getString("name");
String location = geoFenceObject.getString("description");
Log.d(TAG, "GeoFenceObject Chat Circle Id parsed is:\t " + circleId);
System.out.println("Chat Circle id is: \t" + circleId);
} catch (JSONException e) {
e.printStackTrace();
}
请帮忙。如何进行json解析
# 1 楼答案
第一个大括号是一个没有解析的JSONObject。 试试下面的代码