title: Failed to deserialize json object to map
body: <p>I know there are similar posts about this issue but please read carefully before marking as duplicate.</p>
  
  <p>I have a text string that I want to convert to a JSON line/instance and then to a Java map variable, so I can access each attribute individualy.
  This is my string:</p>
  
  <pre><code>{"S3_r5_Ahf": "0.00025", "S15_r6_Alf": "-0.00514", "S6_r4_Alf": "-0.00126", "S12_r9_Alf": "-0.00595", "S13_r8_Ahf": "0.00018", "S1_r9_Alf": "-0.00385", "S8_r10_Alf": "-0.00849" }
  </code></pre>
  
  <p>Using the GSON library I converted the string to a json object using: </p>
  
  <pre><code>Gson gson = new Gson();
  String json = gson.toJson(s);
  </code></pre>
  
  <p>And this works great, the output being:</p>
  
  <pre><code>"{\"S3_r5_Ahf\": \"0.00025\", \"S15_r6_Alf\": \"-0.00514\", \"S6_r4_Alf\": \"-0.00126\", \"S12_r9_Alf\": \"-0.00595\", \"S13_r8_Ahf\": \"0.00018\", \"S1_r9_Alf\": \"-0.00385\", \"S8_r10_Alf\": \"-0.00849\"
  </code></pre>
  
  <p>The problem is when I try to convert it to a map by using:</p>
  
  <pre><code>Type type = new TypeToken&lt;Map&lt;String, String&gt;&gt;(){}.getType();
  Map&lt;String, String&gt; retMap = gson.fromJson(json,type);
  </code></pre>
  
  <p>When I try to print retMap I get the error: The JsonDeserializer MapTypeAdapter failed to deserialize json object to map.</p>
  
  <p>What am I doing wrong?
  Thank you.</p>