title: Jackson : deserializing a map
body: <p>I'm using Jackson to deserialize a json file from a HTTP Response:</p>
  
  <pre><code>    ObjectMapper mapper = new ObjectMapper();
      InputStream responseBody = response.getBody().in();
      RawDataBody rawdataBody = mapper.readValue(responseBody, RawDataBody.class);
  </code></pre>
  
  <p>I also tries this but it doesn't work :</p>
  
  <pre><code>RawDataBody rawdataBody = mapper.readValue(responseBody.toString(), RawDataBody.class);
  </code></pre>
  
  <p>This is the error that I'm getting :</p>
  
  <pre><code>Exception in thread "main" com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of com.ubiant.hemis.accounts.TineaSeas.Model.RawDataBody out of START_ARRAY token at [Source: java.io.ByteArrayInputStream@19da0cd; line: 1, column: 1]
  at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:164)
  at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:575)
  at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:569)
  at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromArray(BeanDeserializerBase.java:1120)
  at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:148)
  at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:123)
  at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:2888)
  at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2080)
  at com.ubiant.hemis.accounts.TineaSeas.Test.main(Test.java:46)
  </code></pre>
  
  <p>The JSON File :`</p>
  
  <pre><code>[
     {  
    "tag":"Volume_D1_10m",
    "value":0.0,
    "quality":1,
    "site":1,
    "supplier":2,
    "zone":0,
    "timestamp":1470297561000
   },
     {  
    "tag":"Tmoy_T4_10m",
    "value":19.2,
    "quality":1,
    "site":1,
    "supplier":2,
    "zone":0,
    "timestamp":1470297561000
   }
  ]
  </code></pre>
  
  <p>This is my model :`</p>
  
  <pre><code>public class RawDataBody implements Serializable  {
  
  @JsonProperty("rawDatas")
  @JsonDeserialize
  private ArrayList&lt;RawData&gt; rawDatas = new ArrayList&lt;RawData&gt;();
  
  public RawDataBody(){     
  }
  
  public RawDataBody rawDatas(ArrayList&lt;RawData&gt; rawDatas) {
      this.rawDatas = rawDatas;
      return this;
  }
  
  @JsonProperty("rawDatas")
  public ArrayList&lt;RawData&gt; getRawDatas() {
      return rawDatas;
  }
  
  @JsonProperty("rawDatas")
  public void setRawDatas(ArrayList&lt;RawData&gt; rawDatas) {
      this.rawDatas = rawDatas;
  }
  
  
  public class RawData implements Serializable  {
  
  private String tag = null;  
  private Double value = null;
  private Integer quality = null;
  private Integer site = null;
  private Integer supplier = null;
  private Integer zone = null;
  private BigDecimal timestamp = null;
  
  
  @JsonProperty("tag")
  public String getTag() {
    return tag;
  }
  
  @JsonProperty("tag")
  public void setTag(String tag) {
    this.tag = tag;
  }
  
  @JsonProperty("value")
  public Double getValue() {
    return value;
  }
  
  @JsonProperty("value")
  public void setValue(Double value) {
    this.value = value;
  }
  
  
  @JsonProperty("quality")
  public Integer getQuality() {
    return quality;
  }
  
  @JsonProperty("quality")
  public void setQuality(Integer quality) {
    this.quality = quality;
  }
  
  
  @JsonProperty("site")
  public Integer getSite() {
    return site;
  }
  @JsonProperty("site")
  public void setSite(Integer site) {
    this.site = site;
  }
  
  
  @JsonProperty("supplier")
  public Integer getSupplier() {
    return supplier;
  }
  
  @JsonProperty("supplier")
  public void setSupplier(Integer supplier) {
    this.supplier = supplier;
  }
  
  
  
  @JsonProperty("zone")
  public Integer getZone() {
    return zone;
  }
  @JsonProperty("zone")
  public void setZone(Integer zone) {
    this.zone = zone;
  }
  @JsonProperty("timestamp")
  public BigDecimal getTimestamp() {
    return timestamp;
  }
  
  @JsonProperty("timestamp")
  public void setTimestamp(BigDecimal timestamp) {
    this.timestamp = timestamp;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Can anyone help me with this ?</p>