【发布时间】:2017-01-18 07:39:59
【问题描述】:
我正在尝试显示 JSONData 中的 JsonArray 值
JSON DATA
{"error":{"group_name":["组名已被占用。"]}}
这是我的代码
httppost.setEntity(new UrlEncodedFormEntity(params));
HttpResponse response = httpclient.execute(httppost);
String responseStr = EntityUtils.toString(response.getEntity());
JSONObject json = new JSONObject(responseStr);
Log.d("Checking Login", responseStr);
JSONArray jsonArray = json.getJSONArray("group_name");
for(int i = 0; i<jsonArray.length();i++){
JSONObject jsonObject = jsonArray.getJSONObject(i);
}
我收到类似这样的异常
org.json.JSONException: No value for group_name
【问题讨论】:
标签: java android arrays json http