title: Convert Json to an object in Android with gson
body: <p>I have a JSON array with a lot of entries and want to deserialize each check into a single object with gson. My problem is to find the proper object structure for it. </p>
  
  <pre><code>Gson gson = new Gson();
  Type collectionType = new TypeToken&lt;List&lt;Client&gt;&gt;(){}.getType();
  List&lt;Client&gt; clients = gson.fromJson(response, collectionType);
  </code></pre>
  
  <p>JSON</p>
  
  <pre><code>[
      {
          "client": "client1",
          "check": {
              "handle": true,
              "standalone": false,
              "interval": 60,
              "refresh": 3600,
              "dependencies": [
                  "keepalive"
              ],
              "command": "xxx",
              "occurrences": 1,
              "subscribers": [
                  "xxx"
              ],
              "aggregate": false,
              "subdue": {
                  "at": "handler",
                  "begin": "6PM ICT",
                  "end": "9AM ICT"
              },
              "name": "xxx",
              "issued": 1437922960,
              "executed": 1437922960,
              "duration": 0.148,
              "output": "xxx",
              "status": 0
          }
      },
      {
          "client": "client1",
          "check": {
              "thresholds": {
                  "warning": 120,
                  "critical": 180
              },
              "handler": "keepalive",
              "name": "keepalive",
              "issued": 1437922959,
              "executed": 1437922959,
              "output": "Keepalive sent from client 13 seconds ago",
              "status": 0
          }
      }, ....
  ] 
  </code></pre>
  
  <p>I tried the object  below but it didnt work, it just gets <code>String client</code> but nothing from the Check class.</p>
  
  <pre><code>public class Check {
      public Boolean handle;
      public Boolean standaloone;
      public int interval;
      public int refresh;
      public String[] dependencies;
      public String commmand;
      public int occurrences;
      public String[] subscribers;
      public Boolean aggregate;
      public String[] subdue;
      public String name;
      public int issued;
      public int executed;
      public float duration;
      public String output;
      public int status;
  }
  
  public class Client {
      public String client;
      public Check check;
  }
  </code></pre>