title: Convert json to Object List
body: <p>I have the following String:  </p>
  
  <pre><code>String json = "[{\"id\": \"0\", \"ip\": \"123\", \"mac\": \"456\"}, {\"id\": \"1\", \"ip\": \"111\", \"mac\": \"222\"}]";
  </code></pre>
  
  <p>And a SlaveEntity Entity that has:</p>
  
  <pre><code>public class SlaveEntity extends BaseEntity {
  
      private String ip;
      private String macAddress;
      private String status;
  
      @OneToMany(mappedBy="slave", targetEntity = PositionEntity.class, fetch = FetchType.EAGER, cascade = CascadeType.ALL)
      private List&lt;PositionEntity&gt; positions;
  
  }
  </code></pre>
  
  <p>I am writing a method that takes the json and returns a List of SlaveEntity:  </p>
  
  <pre><code>public static List&lt;SlaveEntity&gt; JsonToSlaveEntity(String json) {
          ObjectMapper objectMapper = new ObjectMapper();
          List&lt;SlaveEntity&gt; obj = new ArrayList&lt;SlaveEntity&gt;();
  
          try {
             obj = objectMapper.readValue(json, List.class);
  
          } catch (IOException e) {
              e.printStackTrace();
          }
          return obj;
      }
  </code></pre>
  
  <p>The problem is that the obj List results like this:  </p>
  
  <p><a href="https://i.stack.imgur.com/qOb1Z.png" rel="nofollow"><img src="https://i.stack.imgur.com/qOb1Z.png" alt="enter image description here"></a></p>
  
  <p>But what I need the obj List to be is like this:  </p>
  
  <p><a href="https://i.stack.imgur.com/cx2xv.png" rel="nofollow"><img src="https://i.stack.imgur.com/cx2xv.png" alt="enter image description here"></a></p>
  
  <p>So how can I get the needed list?</p>