title: Parsing json file with gson
body: <p>I have a problem creating a mapping for a json that i want to parse using json. It's very specific, its about a json file with a json array with objects in it.</p>
  
  <p>my jsonfile starts like this:</p>
  
  <pre><code>  [
      {
          "venue": {
              "venue_seasons": [
                  {
                      "created_at": "2011-12-25T23:00:28Z",
                      "updated_at": "2011-12-28T15:13:53Z",
                      "start_timestamp": 1293840000,
                      "id": 337,
                      "end": "2011-12-24T00:00:00Z",
                      "enabled": true,
                      "start": "2011-01-01T00:00:00Z",
                      "season_openings": [ … ],
                      "end_timestamp": 1324684800
                  },
                  { … }
              ],
              "address": "someadress",
              "city": "cityname",
              "name": "name",
              "created_at": "2011-03-31T07:55:33Z",
          etcetera
      }
      "venue":{another venue
  </code></pre>
  
  <p>So first an array, than an object (venue) with a lot of objects in it (i removed most of them, because thats not important for my question), and some arrays (like season_openings).</p>
  
  <p>My parsing code works like this, im using gson. The inputstream works fine.</p>
  
  <pre><code>Reader reader = new InputStreamReader(inputStream);
  JsonResponse venueResponse = gson.fromJson(reader, JsonResponse.class);               
  List&lt;Venues&gt; results = venueResponse.venue;
  </code></pre>
  
  <p>with the class JsonResponse:</p>
  
  <pre><code>public class JsonResponse {
      public List&lt;Venues&gt; venue;  
  }
  </code></pre>
  
  <p>and Venues.class:</p>
  
  <pre><code>public class Venues {
  
      public List&lt;VenueSeasons&gt; venue_seasons;
  
      @SerializedName("adress")
      public String getAdress;
  
      @SerializedName("city")
      public String getCity;
  
      @SerializedName("country")
      public String getCountry; etcetera 
  }
  </code></pre>
  
  <p>But when i run this code i get an error:</p>
  
  <pre><code>Unable to start activity ComponentInfo{com.hera.android.JSON/com.hera.android.JSON.TestParser2Activity}: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2
  </code></pre>
  
  <p>Ofcourse i can read the error: it expects an objects but get an array. I varied a lot with different jsonresponse.class and even with putting the whole json array in a json object (what is not really a solution because i need to work with this type of jsonfile). But everytime i get this or a similar error.</p>
  
  <p>I think I'm close to a solution, can anyone see what i just can't and give me a helping hand?
  Thanks.</p>