title: Java Jackson: JSON value unknown
body: <p>I'm still learning how to use Jackson...</p>
  
  <p>So I have a JSON object that has a value that sometimes is an Integer, a long String, or a List</p>
  
  <p>Value: Integer</p>
  
  <pre><code>{
    "id":1,
    "active":1,
    "name":"name1",
    "value":155,
    ...
  </code></pre>
  
  <p>Value: String</p>
  
  <pre><code>{
    "id":2,
    "active":1,
    "name":"name2",
    "value":"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book...",
    ...
  </code></pre>
  
  <p>Value: List</p>
  
  <pre><code>{
    "id":3,
    "active":1,
    "name":"name3",
    "value":[
      "One",
      "Two",
      "Three",
      "Four"],
    ...
  </code></pre>
  
  <p>So all together it looks like...</p>
  
  <pre><code>{
    {
        "id":1,
        "active":1,
        "name":"name1",
        "value":155,
        ...
    },
    {
        "id":2,
        "active":1,
        "name":"name2",
        "value":"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book...",
        ...
    },
    {
        "id":3,
        "active":1,
        "name":"name3",
        "value":[
          "One",
          "Two",
          "Three",
          "Four"],
        ...
    }
  }
  </code></pre>
  
  <p>Here my POJO Model</p>
  
  <pre><code>@JsonIgnoreProperties(ignoreUnknown=true)
  @JsonAutoDetect(fieldVisibility= JsonAutoDetect.Visibility.ANY)
  public class OQScoresRows {
    private int id;
    private int active;
    private String name;
    private List&lt;String&gt; value;
    ... ...
  </code></pre>
  
  <p>Here's my mapper code</p>
  
  <pre><code>ObjectMapper mapper = new ObjectMapper();
  try{
    POJO obj = mapper.readValue(&lt;JSONOBJECT&gt;, POJO.class);
  }catch(JsonParseException e){
    return mapper.writeValueAsString(e);
  }
  </code></pre>
  
  <p>The problem is when I execute my code, I get the following error:</p>
  
  <pre><code>com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of VALUE_NUMBER_INT token
  </code></pre>
  
  <p>It's clear to me that this is happening because "value" can contain one of three different types, how do I make my code flexible enough to accommodate the types...I can always in other methods detect if the value is an int, List, or String but I first need to model (don't I)...</p>
  
  <p>My question is simple: how do I make my code flexible enough to accommodate the types...</p>