title: How does the Jackson mapper know what field in each Json object to assign to a class object?
body: <p>Let's say I have a Json object like this:</p>
  
  <pre><code>{
      "name": "Bob Dole",
      "company": "Bob Dole Industries",
      "phone": {
          "work": "123-456-7890",
          "home": "234-567-8901",
          "mobile": "345-678-9012"
      }
  }
  </code></pre>
  
  <p>And to help me read it, I use Jackson's Object Mapper with the following class:</p>
  
  <pre><code>public class Contact {
          public static class Phone {
          private String work;
          private String home;
          private String mobile;
  
          public String getWork() { return work; }
          public String getHome() { return home; }
          public String getMobile() { return mobile; }
  
          public void setWork(String s) { work = s; }
          public void setHome(String s) { home = s; }
          public void setMobile(String s) { mobile = s; }
      }
  
      private String name;
      private String company;
      private Phone phone;
  
      public String getName() { return name; }
      public String getCompany() { return company; }
      public Phone getPhone() { return phone; }
  
      public void setName(String s) { name = s; }
      public void setCompany(String s) { company = s; }
      public void setPhone(Phone p) { phone = p; }
  }
  </code></pre>
  
  <p>My question is, how (using the simplest explanation possible), does the Object mapper "deserialize" the Json object? I thought it was matching variable names, but changing them by a few letters didn't affect the output. Then, I tried switching the order of the set() functions, but that didn't do anything. I also tried both, but that was also useless. I'm guessing there's something more sophisticated at work here, but what?</p>
  
  <p>I tried to look in the documentation and past code, but I didn't see an explanation that made sense to me.</p>