我有以下JSON-String:
{"Employee_Reports":[{"UserId":"10"},{"UserId":"12"},{"UserId":"13"},{"UserId":"14"},{"UserId":"15"},{"UserId":"1"},{"UserId":"5"},{"UserId":"11"}{"UserId":""}]}
我想将所有UserId存储在自定义适配器类中的字符串数组中:
JSONObject jObject = new JSONObject(route_response);
JSONArray jsonArray = jObject.optJSONArray("Employee_Reports");
for(int i=0; i < jsonArray.length(); i++)
{
status = new String[jsonArray.length()];
for(int t=0; t<jsonArray.length(); t++) {
jObject = jsonArray.getJSONObject(t);
status[t] = jObject.getString("UserId");
它不起作用,因为它显示错误。