title: GSON list of list
body: <p>How do I deserialize a list of lists using Gson? </p>
  
  <p>For example, given the following JSON string:</p>
  
  <pre><code>{
    vars: [
      [ 1, 2, 3 ],
      [ 4, 5 ]
    ]
  }
  </code></pre>
  
  <p>I can create the following two POJOs, to try and deserialize it:</p>
  
  <pre><code>class ThisDoesNotWork {
    public List&lt;List&lt;Integer&gt;&gt; vars;
  }
  </code></pre>
  
  <p>Running <code>gson.fromJson(jsonStr, ThisDoesNotWork.class);</code> throws a <code>com.google.gson.JsonSyntaxException</code>.</p>
  
  <p>But the following works (although it's not very usable):</p>
  
  <pre><code>class ThisWorks {
    public List&lt;Object&gt; vars;
  }
  </code></pre>
  
  <p>If I attach a debugger to the output of <code>gson.fromJson(jsonStr, ThisWorks.class);</code>, I can see that the deserialized <code>vars</code> object contains:</p>
  
  <pre><code>vars = {java.util.ArrayList}, size = 2
  |-- [0] = {java.util.ArrayList}, size = 3
       |-- [0] = {java.lang.Integer}, value = 1
       |-- [1] = {java.lang.Integer}, value = 2
       |-- [2] = {java.lang.Integer}, value = 3
  |-- [1] = {java.util.ArrayList}, size = 2
       |-- [0] = {java.lang.Integer}, value = 4
       |-- [1] = {java.lang.Integer}, value = 5
  </code></pre>
  
  <p>So my question is, how do I correctly deserialize lists of lists using Gson? </p>