title: Json to Java Object with same key but different objects inisde
body: <p>I have a question how to map JSON Objects with same key to different objects.
  If I write 2 classes with the specific fields I get an error because the data element is contained twice.</p>
  
  <p>How can I map the resource A to class A and the resource B to class B?</p>
  
  <pre><code>{
     "ETag":"oiojojojojoj==",
     "elements":[
        {
           "resource":"A",
           "ETag":null,
           "data":[
              {
                 "anotherfield":"text",
                 "id":1,
                 "name":"GB"
              }
           ]
        },
        {
           "resource":"B",
           "ETag":"dmVuZG9yOzIwMTctMDUtMDlUMTQ6MzE6NDNa",
           "data":[
              {
                 "field":"read",
                 "id":1
              }
           ]
        }
     ]
  }
  </code></pre>
  
  <p>The classes could look like this:</p>
  
  <pre><code>public class Element {
      @JsonProperty("resource")
      public String resource = null;
      @JsonProperty("ETag")
      public Object eTag = null;
      @JsonProperty("data")
      public List&lt;A&gt; dataInA = null;
      @JsonProperty("data")
      public List&lt;B&gt; dataInB = null;
  }
  
  public class Example {
  
      @JsonProperty("ETag")
      public String eTag;
      @JsonProperty("elements")
      public List&lt;Element&gt; elements = null;
  
  }
  </code></pre>
  
  <p><strong>Class A</strong></p>
  
  <pre><code>public class A {
  
      @JsonProperty("anotherfield")
      public String anotherfield;
      @JsonProperty("id")
      public Integer id;
      @JsonProperty("name")
      public String name;
  
  }
  </code></pre>
  
  <p><strong>Class B</strong></p>
  
  <pre><code>public class B {
  
      @JsonProperty("field")
      public String field;
      @JsonProperty("id")
      public Integer id;
  
  }
  </code></pre>
  
  <p>Thanks a lot!</p>
  
  <p>EDIT:</p>
  
  <p>When I switch the JSON elements to dataA and dataB It works.</p>
  
  <pre><code>{
     "ETag":"oiojojojojoj==",
     "elements":[
        {
           "resource":"A",
           "ETag":null,
           "dataA":[
              {
                 "anotherfield":"text",
                 "id":1,
                 "name":"GB"
              }
           ]
        },
        {
           "resource":"B",
           "ETag":"dmVuZG9yOzIwMTctMDUtMDlUMTQ6MzE6NDNa",
           "dataB":[
              {
                 "field":"read",
                 "id":1
              }
           ]
        }
     ]
  }
  </code></pre>
  
  <p><strong>Element class:</strong> </p>
  
  <pre><code>public class Element {
  
      @JsonProperty("resource")
      public String resource;
      @JsonProperty("ETag")
      public Object eTag;
      @JsonProperty("dataA")
      public List&lt;A&gt; dataInA;
      @JsonProperty("dataB")
      public List&lt;B&gt; dataInB;
  
  }
  </code></pre>