title: Using Jackson to deserialize JSON objects to POJOs
body: <p>I'm trying to use Jackson in an Android project via the ObjectMapper.</p>
  
  <p>My POJO is as follows:</p>
  
  <pre><code>public class Product {
      @JsonProperty("title")
      String title;
      @JsonProperty("vendor")
      String vendor;
  
      public void setTitle(String title){ this.title = title; }
      public void setVendor(String vendor){ this.vendor = vendor; }
  
      public String getTitle() { return title; }
      public String getVendor() { return vendor; }
  }
  </code></pre>
  
  <p>I've written up a Unit Test to see if I could get Jackson working to deserialize my JSON objects.</p>
  
  <pre><code>Context ctx;
  
  public void setUp() throws Exception {
      super.setUp();
      ctx = getContext();
  }
  
  public void testConvertJSONToProduct() throws Exception {
      ObjectMapper m = new ObjectMapper();
      Product product = m.readValue(ctx.getAssets().open("foo.json"), Product.class);
  
      assertEquals("Macbook", product.getTitle());
  }
  </code></pre>
  
  <p>My actual JSON file contains much more information than what I've set in my Product, but I just want to get it working.  Using the larger file it causes the Product to get created but all it's values are set to null. I thought this might be because of all the data that is in there, so I created another file (foo.json) that contains the following:</p>
  
  <pre><code>{"title" : "Macbook", "vendor" : "Apple"}
  </code></pre>
  
  <p>With which I am also getting the same problem.</p>