如何用 Java 读取这个 JSON?

我有这段JSON代码,但我不知道如何阅读poster_path。我知道有很多教程,但没有一个对我有用,如果有人帮助我,那就太好了。


{  

   "movie_results":[  

      {  

         "adult":false,

         "backdrop_path":"/j9XKiZrVeViAixVRzCta7h1VU9W.jpg",

         "genre_ids":[  

            80,

            18

         ],

         "id":278,

         "original_language":"en",

         "original_title":"The Shawshank Redemption",

         "overview":"Framed in the 1940s for the double murder of his wife and her lover, upstanding banker Andy Dufresne begins a new life at the Shawshank prison, where he puts his accounting skills to work for an amoral warden. During his long stretch in prison, Dufresne comes to be admired by the other inmates -- including an older prisoner named Red -- for his integrity and unquenchable sense of hope.",

         "poster_path":"/9O7gLzmreU0nGkIB6K3BsJbzvNv.jpg",

         "release_date":"1994-09-23",

         "title":"The Shawshank Redemption",

         "video":false,

         "vote_average":8.6,

         "vote_count":11374,

         "popularity":30.881

      }

   ],

   "person_results":[  


   ],

   "tv_results":[  


   ],

   "tv_episode_results":[  


   ],

   "tv_season_results":[  


   ]

}


凤凰求蛊
浏览 159回答 1
1回答

一只斗牛犬

使用 JSONObject:JSONOBject json = new JSONObject(string);String posterPath = json.getJSONArray("movie_results")                    .getJSONObject(index)                    .getString("poster_path");
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java