我成功地获得了电影的名称和年份,但不知何故没有得到概要。据我了解对象的形状,它们应该可以以相同的方式到达:
JSONObject resultOBJ = new JSONObject(result);
Log.v("hhhh",resultOBJ.toString());
JSONArray movArr = resultOBJ.getJSONArray("movies");
JSONObject movOBJ =movArr.getJSONObject(0);
String title = movOBJ.getString("title");
String synop = movOBJ.getString("synopsis");
nameView.setText(title);
synopView.setText(synop);
我收到的对象看起来像这样(无格式):
{
"total": 1,
"movies": [
{
"critics_consensus": "Deftly blending comedy, ...",
"id": "770672122",
"mpaa_rating": "G",
"ratings": {
"audience_rating": "Upright",
"audience_score": 87,
"critics_rating": "Certified Fresh",
"critics_score": 99
},
"release_dates": {
"dvd": "2010-11-02",
"theater": "2010-06-18"
},
"runtime": 103,
"title": "Toy Story 3",
"year": 2010,
"synopsis": "Pixar returns to their first success with ...
等等……