title: Map Nested JSON Objects to Java Classes with Spring RestTemplate
body: <p>I know this may be simple. However, I just can't get it to work.</p>
  
  <p>So I am trying to use Spring RestTemplate to map my JSON data. I have following JSON response from a rest call.</p>
  
  <pre><code>{
    "message":"ok",
    "status":"ok",
    "data":[
        {"Name":"Yo",
         "Address":"100 Test Rd"},
        {...},
        {...}
     ]
  }
  </code></pre>
  
  <p>And here is the class I am trying to map it to.</p>
  
  <pre><code>@JsonIgnoreProperties(ignoreUnknown = true)
  public class Response implements Serializable {
  
    private String message;
    private String status;
    private List&lt;Data&gt; data;
  
    // I could also use a array instead
    // private Data[] data;
  }
  </code></pre>
  
  <p>Here is my Data class:</p>
  
  <pre><code>@JsonIgnoreProperties(ignoreUnknown = true)
  public class Data implements Serializable {
  
    private String Name;
    private String Address;
  }
  </code></pre>
  
  <p>Here is the code I used to call RestTemplate:</p>
  
  <pre><code>public Reponse getResponse() {
      ResponseEntity&lt;Reponse&gt; responseEntity = restTemplate.getForEntity(Url, Reponse.class);
  
      return responseEntity.getBody();
  }
  </code></pre>
  
  <p>Now here comes the problem. I was able to get "message" and "status", But when I try to log/print data, it shows null. Not exactly sure what's going on here. I really could use some help. Thanks.</p>