I'm getting the following JSON response from IMDB.
{
 "Search":
    [
      {
       "Title":"Seven Pounds",
       "Year":"2008",
       "imdbID":"tt0814314",
       "Type":"movie",
       "Poster":"someUrl"
      },
     {
       "Title":"Seven Samurai",
       "Year":"1954",
       "imdbID":"tt0047478",
       "Type":"movie",
       "Poster":"someUrl"
     }
    ],
    "totalResults":"1048",
    "Response":"True"
}
I'd like to extract every movie and store it into a List so I've created a class MovieContainer with a List of Movies, where each Movie contains String attributes describing details about said movie e.g. title, year yiddi yadda - you get the drill!
I used the following code snippet to;
MovieContainer cnt = new Gson().fromJson(jstring, MovieContainer.class);
where jstring is a valid json string similar to the json string sample above, but when I try to iterate over the List in the MovieContainer instance I get a NullPointerException.
I'm new to GSON hence not sure what's the cause?
EDIT: I do know what a NullPointerException is, but I don't understand why Java throws it in my example.
My MovieContainer class:
public class MovieContainer {
    public List<Movie> movies;
}
My Movie class:
public class Movie {
    String Title;
    String Year;
    String Poster;
    String imdbID;
    String Type;
}
I'm expecting the call to the fromJson method to fill my List with the information matching the fields' name, but the List movies points is null.
 
     
     
     
    