title: Gson in Java : Attemped to deserialize a java.lang.Class. Forget to register a type adater
body: <p>I'm trying to parse a JSON string like this one :</p>
  
  <pre><code>{
  "Message":"OK",
  
  "Obj":
    {
      "IdCatrgorie":"1",
      "Name":"catg1",
      "IdUser":"2"
    },
  
  "Statue":"OK"
  }
  </code></pre>
  
  <p><strong>Response Class (Android) :</strong></p>
  
  <pre><code>public class Response&lt;T&gt; {
  
      public String Message;
      public Class&lt;T&gt;  Obj;
      public String Statue;
  
  public Response() {
  
      }
  }
  </code></pre>
  
  <p><strong>Categorie Class :</strong> </p>
  
  <pre><code>public class Categorie {
  
  
  
          public int IdCatrgorie;
          public int IdUser;
          public String Name;
  
          public Categorie(){}
  }
  </code></pre>
  
  <p><strong>Main Class :</strong> </p>
  
  <pre><code>private static String readUrl(String urlString) throws Exception {
      BufferedReader reader = null;
      try {
          URL url = new URL(urlString);
          reader = new BufferedReader(new InputStreamReader(url.openStream()));
          StringBuffer buffer = new StringBuffer();
          int read;
          char[] chars = new char[1024];
          while ((read = reader.read(chars)) != -1)
              buffer.append(chars, 0, read); 
  
          return buffer.toString();
      } finally {
          if (reader != null)
              reader.close();
      }
  }
  
  
  public static void Main(.....)
  {
        String json;
          try {
              json = readUrl("http://192.168.56.1:91/truescan/");
  
              GsonBuilder gsonBuilder = new GsonBuilder();
  
              Gson gson = gsonBuilder.create();
  
              Response&lt;Categorie&gt; posts = gson.fromJson(json, Response.class);
              Toast.makeText(MainActivity.this, String.valueOf(response.Message), Toast.LENGTH_LONG).show();
  
          } catch (Exception e) {
              // TODO Auto-generated catch block
              Toast.makeText(MainActivity.this, String.valueOf("exception"+e.getMessage()), Toast.LENGTH_LONG).show();
          }
  
  
  }
  </code></pre>
  
  <p>But it throws me with</p>
  
  <pre><code>Attemped to deserialize a java.lang.Class. Forget to register a type adapter
  </code></pre>
  
  <p><strong><em>When i remove "Obj" attribute From Response classe it's work but witout get Obj Data</em></strong></p>
  
  <p>Any ideas how should I fix it?</p>
  
  <p>Thanks!</p>