title: RestTemplate getForObject to POJO
body: <p>I'm using <code>RestTemplate.getForObject()</code> to retrieve json that includes a couple of objects and arrays, I only want to convert one of the objects inside this json to a POJO, I don't care about the other objects inside this json. </p>
  
  <p>What is the proper way to approach this?</p>
  
  <hr>
  
  <p>Edit:</p>
  
  <p>Another approach from accepted answer, we can use jacksons <code>ObjectMapper</code></p>
  
  <pre><code>@Autowired
  private ObjectMapper jacksonObjectMapper;
  </code></pre>
  
  <p>then</p>
  
  <pre><code>LinkedHashMap obj1 = restTemplate.getForObject(uri, LinkedHashMap.class, params);
  LinkedHashMap obj2 = (LinkedHashMap)test.get("flightStatuses");
  
  Flight flight = jacksonObjectMapper.convertValue(obj2, Flight.class);
  </code></pre>
  
  <p>You get the idea, just get a generic datatype from your json structure then use <code>ObjectMapper</code> to convert it to the class you need.</p>