title: Json array to Java class (deserializing with Gson)
body: <p>I have Json response (named as jsonResultAsText):</p>
  
  <pre><code>{
  "Title": "Hi all",
  "IsSecret": false,
  "Agents": [
      {
          "ID": 3,
          "Name": "John F"
      },
      {
          "ID": 7,
          "Name": "Jack D"
      }
  ]
  }
  </code></pre>
  
  <p>I want to deserialize it using Google's gson library.</p>
  
  <p>I have classes like:</p>
  
  <pre><code>public class JsonResponse {
      public String Title;
      public boolean IsSecret;
  
      public List&lt;Agent&gt; Agents;
  }
  
  public class Agent {
      public int ID;
      public String Name;
  }
  </code></pre>
  
  <p>I want to get json data into JsonResponse class.</p>
  
  <p>It's the code that I try to achieve:</p>
  
  <pre><code>JsonResponse response = 
                   new Gson().fromJson(jsonResultAsText, JsonResponse.class);
  </code></pre>
  
  <p>But my Android application gives that classic error: Unfortunately, &lt; app_name > has stopped.</p>
  
  <p>I know that there are plenty examples about serializing/deserializing via gson class, but I could not find similar problem/example.</p>
  
  <p>Thanks in advance.</p>