title: Jackson JSON - Deserialize Commons MultiMap
body: <p>i want to serialize and deserialize a MultiMap (Apache Commons 4) using JSON.</p>
  
  <p>Piece of code to test:</p>
  
  <pre><code>MultiMap&lt;String, String&gt; map = new MultiValueMap&lt;&gt;();
  map.put("Key 1", "Val 11");
  map.put("Key 1", "Val 12");
  map.put("Key 2", "Val 21");
  map.put("Key 2", "Val 22");
  
  ObjectMapper mapper = new ObjectMapper();
  String jsonString = mapper.writeValueAsString(map);
  MultiMap&lt;String, String&gt; deserializedMap = mapper.readValue(jsonString, MultiValueMap.class);
  </code></pre>
  
  <p>The serialization works fine and results in a format I would expect:</p>
  
  <pre><code>{"Key 1":["Val 11","Val 12"],"Key 2":["Val 21","Val 22"]}
  </code></pre>
  
  <p>Unfortunately the deserialization produces a result that is not the way it should look like:
  After the deserialization, the Multimap contains an <strong>ArrayList inside an ArrayList</strong> for the values of a key, not an single ArrayList for the key containing the values.</p>
  
  <p>This result is produced due to the fact that the <code>put()</code> method of the multi map is called to add the array found in the json string, as the MultiMap implements the Map interface.</p>
  
  <p>The MultiMap implementation itself again then creates an ArrayList if a new value is put to a non existing key.</p>
  
  <p>Is there any way to circumvent this?</p>
  
  <p>Thank you for your help!</p>