title: How to serialize values of nested json without using a wrapper class in Spring RestTemplate?
body: <p>I'm trying to consume a rest API call using Spring as below:</p>
  
  <pre><code>HttpHeaders headers = new HttpHeaders();
  headers.add("Authorization", "Basic " + base64Creds);
  
  HttpEntity&lt;String&gt; request = new HttpEntity&lt;String&gt;(headers);
  RestTemplate restTemplate = new RestTemplate();
  
  Orders orders = restTemplate.exchange(url, HttpMethod.GET, request, Orders.class).getBody();
  </code></pre>
  
  <p>The response I get is in following form:</p>
  
  <pre><code>{    
  "orders":[{
      "field1": value1,
      "address":[{
          "city":"...",
          "state":"..."
      }]
  }]
  }
  </code></pre>
  
  <p>The Orders class has following fields:</p>
  
  <pre><code>Class Orders{
      String field1;
      Address address;
  
      // Getter / setter methods
  }
  </code></pre>
  
  <p>Is it possible to map the values of "field1", and "address" directly to the fields inside Orders class? I cannot change the JSON response which I receive.</p>
  
  <p>Thanks in advance.</p>