-1

I have this JSON code and I don't know how to read poster_path. I know there's a lot of tutorials but none of them worked for me, it would be really great if someone help me.

{  
   "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":[  

   ]
}
Gayan Mettananda
  • 1,498
  • 14
  • 21
Hedi Hadi
  • 33
  • 5

1 Answers1

1

Using JSONObject:

JSONOBject json = new JSONObject(string);
String posterPath = json.getJSONArray("movie_results")
                    .getJSONObject(index)
                    .getString("poster_path");
Binary Igor
  • 168
  • 1
  • 5