title: How can I read JSON data from a URL in Java?
body: <p>This is my Aman class:</p>
  
  <pre><code>import org.codehaus.jackson.annotate.JsonIgnoreProperties;
  
  @JsonIgnoreProperties(ignoreUnknown=true)
  public class  Aman
  {
  
  public static class Title
  {
      private String title;
  
      public String getTitle(){ return title; }
  
      public String setTitle(String s){ return title = s; }
  }
  
  private int id;
  private int year;
  private int total;
  
  public void id(int i){ id = i; }
  
  public void year(int y){ year = y; }
  
  public void total(int t){ total =t; }
  }
  </code></pre>
  
  <p>This is the Movie class that is mapping the values:</p>
  
  <pre><code>import java.io.File;
  import java.io.IOException;
  import org.codehaus.jackson.JsonGenerationException;
  import org.codehaus.jackson.map.JsonMappingException;
  import org.codehaus.jackson.map.ObjectMapper;
  import java.net.*;
  
  public class Movie
  {
   public static void main(String[] args) throws MalformedURLException, URISyntaxException, IOException {
   Aman a = new Aman();
   ObjectMapper mapper = new ObjectMapper();
   URL RT = new URL("http://api.rottentomatoes.com/api/public/v1.0/movies.json?apikey=gzscv4f8zqse75w94mmp37zz&amp;q=Toy+Story+3&amp;page_limit=1").toURI().toURL();
   a = mapper.readValue(RT, Aman.class);
      }
  
  }
  </code></pre>
  
  <p>I am getting the same exception over and over again. </p>
  
  <p>Am I doing something wrong? </p>
  
  <p>Here is the exception that keeps occuring:</p>
  
  <p><code>
  Exception:Exception in thread "main" org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "total" (Class Aman), not marked as ignorable
   at [Source: http://api.rottentomatoes.com/api/public/v1.0/movies.json?apikey=gzscv4f8zqse75w94mmp37zz&amp;q=Toy+Story+3&amp;page_limit=1; line: 31, column: 11] (through reference chain: Aman["total"])
  </code></p>