title: Deserialize to an ImmutableMap with GSON
body: <p>I'd like to use GSON to derialize:</p>
  
  <pre><code>"starterItems": {
      "Appeltaart": 3,
      "Soap_50": 3
  }
  </code></pre>
  
  <p>...into a Guava <code>ImmutableMap</code>:</p>
  
  <pre><code>private ImmutableMap&lt;String,Integer&gt; starterItems;
  </code></pre>
  
  <p>I thought I'd just use regular GSON map parsing, then make an immutable copy of the result, like this:</p>
  
  <pre><code>    gb.registerTypeAdapter(ImmutableMap.class, new JsonDeserializer&lt;ImmutableMap&gt;() {
          @SuppressWarnings("unchecked")
          @Override public ImmutableMap deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
              return ImmutableMap.copyOf((Map) context.deserialize(json, Map.class));
          }
      });
  </code></pre>
  
  <p>But as expected, that was too simple (there is no type information). I get the error:</p>
  
  <pre><code>com.google.gson.JsonParseException: The JsonDeserializer MapTypeAdapter failed to deserialized json object {"Appeltaart":3,"Soap_50":3} given the type interface java.util.Map
  </code></pre>
  
  <p>Can I do what I want?</p>