title: How to map dynamic JSON in JAX-RS
body: <p>I have to map a JSON to Java PoJos using JAX-RS (Resteasy as implementation). The problem is, that the JSON is dynamic. Look at this example:</p>
  
  <pre><code>{
    "typeCode": "SAMPLE",
    "data": [
      {
        "id": "COMMENTS",
        "answerValue": {
          "type": "YesNoAnswer",
          "value": true
        }
      },
      {
        "id": "CHOICE",
        "answerValue": {
          "type": "SelectListAnswer",
          "values": ["choice1", "choice2"]
        }
      }
    ]
  }
  </code></pre>
  
  <p>The dynamic elements are in the data array. In principal every entry has an ID and an answerValue. But the answerValue is dynamic. Depending on his type he can have a single value (boolean, string, number an object) or an array of values.</p>
  
  <p>How can I map this to my Java model?</p>