title: How to use Gson to parse JSON file that contains arrays
body: <p>I am trying to read a JSON file from <a href="https://raw.githubusercontent.com/vedantroy/image-test/master/index.json" rel="nofollow noreferrer">this</a> URL using <a href="https://github.com/koush/ion" rel="nofollow noreferrer">ion</a>, a library for Android, and Gson.</p>
  
  <p>The JSON file in its current state:</p>
  
  <pre><code>{
      "Excited":["https://github.com/vedantroy/image-test/raw/master/Happy/excited1.gif",
                  "https://github.com/vedantroy/image-test/raw/master/Happy/excited2.gif",
                  "https://github.com/vedantroy/image-test/raw/master/Happy/excited3.gif"],
  
      "Sad":["https://github.com/vedantroy/image-test/raw/master/Sad/sad1.gif",
              "https://github.com/vedantroy/image-test/raw/master/Sad/sad2.gif",
              "https://github.com/vedantroy/image-test/raw/master/Sad/sad3.gif",
              "https://github.com/vedantroy/image-test/raw/master/Sad/sad4.gif"]
  
  }
  </code></pre>
  
  <p><strong>Important note</strong>: While right now the JSON file has two arrays, "Excited" and "Sad", it may have more arrays in the future. However, the base structure of the file will always be a series of JSON arrays. </p>
  
  <p>My objective is to convert this JSON object containing two (but could be more) arrays into a list of lists. </p>
  
  <p>Here is my code so far, it parses the URL and returns a Gson <code>JsonObject</code> called "result":</p>
  
  <pre><code>Ion.with(applicationContext)
                  .load("https://raw.githubusercontent.com/vedantroy/image-test/master/index.json")
                  .asJsonObject()
                  .setCallback { e, result -&gt;
                      //Do something...
                  }
  </code></pre>
  
  <p>This code can also be written as:</p>
  
  <pre><code>Ion.with(applicationContext)
                  .load("https://raw.githubusercontent.com/vedantroy/image-test/master/index.json")
                  .asJsonObject()
                  .setCallback(object : FutureCallback&lt;JsonObject&gt; {
                      override fun onCompleted(e: Exception?, result: JsonObject?) {
                          TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
                      }
  
                  })
  </code></pre>