答案 0 :(得分:0)
试一试:
List<String> allNames = new ArrayList<String>();
JSONArray cast = jsonResponse.getJSONArray("abridged_cast");
for (int i=0; i<cast.length(); i++) {
JSONObject actor = cast.getJSONObject(i);
String name = actor.getString("name");
allNames.add(name);
}
(直接输入浏览器,因此未经测试)。
答案 1 :(得分:0)
您可以创建预测类模型并使用GSON
解析它:
Gson gson = new Gson();
List<Forecast> allForecasts = new ArrayList<Forecast>();
JsonReader reader = new JsonReader(new StringReader(jsonResponse));
reader.setLenient(true);
Type collectionType = new TypeToken<Collection<Forecast>>(){}.getType();
allForecasts = gson.fromJson(reader, collectionType);
Log.i("allForecasts ", allForecasts.get(0).getForecast()get(0).getDate());