title: GSON fromJson with complex JSONObject not working
body: <p>I'm trying to use GSON fromJson() with a simple JSONObject, but it's not working for some reason. And it's not printing any stacktrace at all. Maybe i'm doing something really wrong in my code and someone can help:</p>
  
  <pre><code>JSONObject json = new JSONObject();
  
  json.put("id", "1");
  json.put("name", "Test 1");
  
  JSONObject json2 = new JSONObject();
  
  json2.put("id", "2");
  json2.put("name", "Test 2");
  
  JSONArray array = new JSONArray();
  array.put(json);
  array.put(json2);
  
  JSONObject jsonAll = new JSONObject();
  jsonAll.put("tests", array );
  
  Gson gson = new Gson();
  
  Test[] data = gson.fromJson(jsonAll.toString(), Test[].class);
  </code></pre>
  
  <p>And my Test class:</p>
  
  <pre><code>public class Test {
  
      public String id;
  
      public String name;
  
      public Test(String id, String name){
          this.id = id;
          this.name = name;
      }
  
  }
  </code></pre>
  
  <p>I'm trying to parse this in Android, and it's not working or printing errors..</p>
  
  <p>Solved:</p>
  
  <p>Test[] data = gson.fromJson(<strong>jsonAll.get("tests").toString()</strong>, Test[].class);</p>
  
  <p>Or use K Neeraj Lal answer, it's working too!</p>