title: What is the difference between Gson.fromJson which takes class as parameter and the one that takes Type as parameter?
body: <p>I was trying to parse a Json object with a structure as follows:</p>
  
  <pre><code>{
  "something@email.com": {
      "data1": {
          "fullName": "Mr X Y",
          "givenName": "X"
      },
      "data2": {
          "age": "70",
          "gender": "Male"
      },
      "data3": [
          {
              "typeId": "xyz",
              "url": "xyz.com"
          }
      ],
      "status": 200,
  },
  "anotherThing@email.com": {
      "data1": {
          "fullName": "Mr A B",
          "givenName": "A"
      },
      "data2": {
          "age": "20",
          "gender": "Male"
      },
      "data3": [
          {
              "typeId": "abc",
              "url": "abc.com"
          }
      ],
      "status": 200,
  }
  }
  </code></pre>
  
  <p>I created a bean <code>TempBean</code> with a field <code>Map&lt;String, Person&gt;</code>, with <code>Person</code> as another bean appropriately defined to accept the Json. </p>
  
  <p>I tried:</p>
  
  <pre><code>Gson.fromJson(data, TempBean.class)
  </code></pre>
  
  <p>but couldn't parse. Also tried <code>Map.class</code> and accepted a <code>Map&lt;String, Person&gt;</code>, but couldn't parse.</p>
  
  <p>However, when I used:</p>
  
  <pre><code>Type dataType = new TypeToken&lt;Map&lt;String, Person&gt;&gt;() {}.getType();
  </code></pre>
  
  <p>and then, </p>
  
  <pre><code>Map&lt;String, Person&gt; tempMap = Gson.fromJson(data, dataType); 
  </code></pre>
  
  <p>I could parse it..!</p>
  
  <p>I wish to know what was the difference it the two approaches and what more should I know to be clear about all of this.</p>