title: Error with Object mapper reading JSON from file
body: <p>I am trying to get to grips with Jackson JSON parser and have found a good tutorial that explains marshalling and unmarshalling. The tutorial is here</p>
  
  <p><a href="http://java.dzone.com/tips/json-processing-using-jackson" rel="nofollow">http://java.dzone.com/tips/json-processing-using-jackson</a></p>
  
  <p>Now I have entered all the code, and I have set up the getters and setters in the username and user class. Now I want to be able to create a User Object from the JSON file as it shows in the tutorial i.e.</p>
  
  <pre><code>User user = mapper.readValue(new File("/Users/adam/Documents/JSON/user.json"), User.class);
  </code></pre>
  
  <p>However this returns an error</p>
  
  <blockquote>
    <p>Exception in thread "main" org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "firstName" (Class UserName), not marked as ignorable
     at [Source: /Users/adam/Documents/JSON/JSON.json; line: 1, column: 40] (through reference chain: User["userName"]->UserName["firstName"])</p>
  </blockquote>
  
  <p>I can create an object from user if I use the String instead like so</p>
  
  <pre><code>String userDataJSON = "{\"userId\":\"100\",\"userName\":{\"firstname\":\"K\",\"middlename\":\"Siva\",\"lastname\":\"Prasad\"},\"dob\":1300878089906}";
  
  User user = mapper.readValue(userDataJSON, User.class);
  </code></pre>
  
  <p>But If I try</p>
  
  <pre><code> JsonFactory jfactory = new JsonFactory();
          JsonParser jParser = jfactory.createJsonParser(new File(
          "/Users/adam/Documents/JSON/user.json"));
  
      User user = mapper.readValue(jParser, User.class);
  </code></pre>
  
  <p>I get the error I showed above.</p>
  
  <p>But same thing. Would anytime be able to tell me what I am doing wrong?? Thanks in advance</p>
  
  <p>The JSON in the file is</p>
  
  <blockquote>
    <p>{
       "userId":"1",
       "userName":{
          "firstName":"Katamreddy",
          "middleName":"Siva",
          "lastName":"PrasadReddy"
       },
       "dob":1331113476212
    }</p>
  </blockquote>