title: Jackson not populating all properties
body: <p>I am working on a simple example using <code>Jackson library</code> to convert a <code>json</code> string back to <code>Java object</code> but I see only few properties are being set on my java object instead of all properties.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.FileNotFoundException;
  import java.io.FileReader;
  import java.io.IOException;
  
  import org.codehaus.jackson.map.ObjectMapper;
  
  public class JsonTest {
      public static void main(String[] args) throws FileNotFoundException, IOException {
  
          StringBuffer buffer = new StringBuffer();       
          String data = "";
          BufferedReader reader = null;
          try {
              reader = new BufferedReader(new FileReader("path-to-sample.json"));
              while ((data = reader.readLine()) != null) {
                  buffer.append(data);
              }
          } finally {
              if (reader != null) {
                  reader.close(); 
              }
          }
  
          System.out.println(buffer.toString());
  
          ObjectMapper mapper = new ObjectMapper();
          Sample obj = mapper.readValue(buffer.toString(), Sample.class);
  
  
          System.out.println(obj);
      }
  }
  </code></pre>
  
  <p>The Sample.java program looks like this:</p>
  
  <pre><code>import org.codehaus.jackson.annotate.JsonIgnoreProperties;
  
  import com.fasterxml.jackson.annotation.JsonProperty;
  
  @JsonIgnoreProperties(ignoreUnknown = true)
  public class Sample {
  
      @JsonProperty("prop_1")
      private String prop1;
      private String prop2;
      @JsonProperty("prop_3")
      private String prop3;
      private String prop4;
  
      // Setters &amp; Getters for the properties.
  
      @Override
      public String toString() {
          return "Sample [prop1=" + prop1 + ", prop2=" + prop2 + ", prop3="
                  + prop3 + ", prop4=" + prop4 + "]";
      }
  
  }
  </code></pre>
  
  <p>Input json string in my file is :</p>
  
  <pre><code>{
      "prop_1": "1",
      "prop2": "2",
      "prop_3": "3",
      "prop4": "4"
  }
  </code></pre>
  
  <p>The output of this program is :</p>
  
  <pre><code>Sample [prop1=null, prop2=2, prop3=null, prop4=4]
  </code></pre>
  
  <p>As per my program the <code>prop1</code> and <code>prop3</code> should not be null. I am not clear where I made mistake.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>If I remove the <code>@JsonProperty</code> annotation then I am getting the exception as :</p>
  
  <pre><code>Exception in thread "main" org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "prop_1" (Class Sample), not marked as ignorable
  </code></pre>
  
  <p>This is my pom.xml file dependencies:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
      &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
      &lt;version&gt;2.6.0&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
      &lt;artifactId&gt;jackson-annotations&lt;/artifactId&gt;
      &lt;version&gt;2.6.0&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
      &lt;artifactId&gt;jackson-mapper-asl&lt;/artifactId&gt;
      &lt;version&gt;1.9.13&lt;/version&gt;
  &lt;/dependency&gt;       
  </code></pre>