title: Deserializing JSON map with "key" & "value" properties does not work with Jackson
body: <p><strong>Questions</strong></p>
  
  <ol>
  <li>To begin with, does the serialized JSON serialization below make sense?</li>
  <li>If so, why am I not getting the Map back?</li>
  <li>What can I do about it on the deserializing side?</li>
  </ol>
  
  <p><strong>JSON serialization of Map&lt;String, String&gt; property (excerpt):</strong></p>
  
  <pre><code>{
    "attributes": {
      "entry": [
        {
          "key": "operating system",
          "value": "GNU/Linux"
        },
        {
          "key": "allergies",
          "value": "weed"
        }
      ]
    }
  }
  </code></pre>
  
  <p><strong>POJO for deserialization:</strong></p>
  
  <pre><code>class Contact implements Comparable&lt;Contact&gt;, Serializable {
      @JsonProperty("attributes")
      private Map&lt;String, String&gt; attributes;
      ...
  }
  </code></pre>
  
  <p>Causes this exception:</p>
  
  <pre><code>Thread-4889 An exception occurred during request network execution :Could not read JSON: Can not deserialize instance of java.lang.String out of START_ARRAY token
              at [Source: libcore.net.http.FixedLengthInputStream@43822760; line: 1, column: 17] (through reference chain: com.example.model.Contact["attributes"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_ARRAY token
              at [Source: libcore.net.http.FixedLengthInputStream@43822760; line: 1, column: 17] (through reference chain: com.example.model.Contact["attributes"])
      org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Can not deserialize instance of java.lang.String out of START_ARRAY token
              at [Source: libcore.net.http.FixedLengthInputStream@43822760; line: 1, column: 17] (through reference chain: com.example.model.Contact["attributes"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_ARRAY token
              at [Source: libcore.net.http.FixedLengthInputStream@43822760; line: 1, column: 17] (through reference chain: com.example.model.Contact["attributes"])
              at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.readInternal(MappingJackson2HttpMessageConverter.java:126)
              at org.springframework.http.converter.AbstractHttpMessageConverter.read(AbstractHttpMessageConverter.java:147)
              at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:76)
              at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:484)
              at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:439)
              at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:237)
              at com.example.providers.Query$1.loadDataFromNetwork(Query.java:99)
              at com.octo.android.robospice.request.CachedSpiceRequest.loadDataFromNetwork(CachedSpiceRequest.java:45)
              at com.octo.android.robospice.request.RequestRunner.processRequest(RequestRunner.java:130)
              at com.octo.android.robospice.request.RequestRunner$1.run(RequestRunner.java:197)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
              at java.util.concurrent.FutureTask.run(FutureTask.java:234)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
              at java.lang.Thread.run(Thread.java:841)
       Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_ARRAY token
              at [Source: libcore.net.http.FixedLengthInputStream@43822760; line: 1, column: 17] (through reference chain: com.example.model.Contact["attributes"])
              at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:691)
              at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:46)
              at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:11)
              at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringMap(MapDeserializer.java:430)
              at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:312)
              at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:26)
              at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:525)
              at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:106)
              at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:242)
              at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:118)
              at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:227)
              at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.des
  </code></pre>
  
  <p><strong>The attributes Object when inspected in debugger after deserialization:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/kCbUx.png" alt="Deserialized Object inspected in debugger"></p>
  
  <p><strong>Further inspection after changing to:</strong></p>
  
  <pre><code>@JsonProperty("attributes")
  private Map&lt;String, List&lt;Map&lt;String, String&gt;&gt;&gt; attributes;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/SJ19c.png" alt="attributes.entrySet()">
  <img src="https://i.stack.imgur.com/bfsij.png" alt="attributes.get(&quot;entry&quot;)"></p>
  
  <p><strong>Dependencies:</strong></p>
  
  <ul>
  <li>com.fasterxml.jackson.core:jackson-core:2.3.0</li>
  <li>com.fasterxml.jackson.core:jackson-databind:2.3.0</li>
  <li>com.fasterxml.jackson.core:jackson-annotations:2.3.0</li>
  </ul>