title: How to use Jackson to deserialize to list or value based upon JSON?
body: <p>I have a json in following format, where in key represents the attribute type and value represents the value of that attribute. </p>
  
  <pre><code>{ "attributes":
  [
    {
      "key":"name",
      "value":"Archit"
    },
    { 
      "key":"website",
      "value":"stackoverflow"
    },
    { 
      "key":"languages",
      "value":[
                "python",
                "java",
                "c++"
              ]
    }
  ]
  }
  </code></pre>
  
  <p>I am trying to map it to an following java object using jackson :</p>
  
  <pre><code>public class Attributes {
    List&lt;Attribute&gt; attributes;
  }
  
  
  
  public abstract class Attribute {
    String key;
  }
  
  
  
  public class SingleValuedAttribute extends Attribute{
    String value;
  }
  
  
  public class MultiValuedAttribute extends Attribute{
    List&lt;String&gt; value;
  }
  
  
    ObjectMapper mapper = new ObjectMapper();
    Attributes attributes = mapper.readValue(new File(jsonFilePath), Attributes.class);
  </code></pre>
  
  <p>I tried having a look at polymorphic deserialization but that required type info in the json object, which doesn't exist in my json ?</p>
  
  <p>Any tips on how to do this ?</p>
  
  <p>PS:
  I can't change the json format.
  The list of keys is not bounded/limited. </p>