title: Working with JsonReader
body: <p>I'm working on android app that should read this json string: </p>
  
  <pre><code>{
  "coord":{
         "lon":145.77,
         "lat":-16.92
  },
  "weather":[
            {
          "id":803,
          "main":"Clouds",
          "description":"broken clouds",
          "icon":"04n"
          }
          ],
    "base":"cmc stations"
  }
  </code></pre>
  
  <p>Something similar to this.</p>
  
  <p>I can read the <code>"coord"</code> values successfully using the following method:</p>
  
  <pre><code>public Coordinates readCoordinates(JsonReader reader) throws IOException{
      double longitude = 0.0;     // lon
      double latitude  = 0.0;     // lat
  
      reader.beginObject();
  
      while (reader.hasNext()){
          String nameToRead = reader.nextName();
          if(nameToRead.equals("lon")){
              longitude = reader.nextDouble();
          }else if (nameToRead.equals("lat")){
              latitude = reader.nextDouble();
          }else {
              reader.skipValue();
          }
      }
      reader.endObject();
      return (new Coordinates(longitude, latitude));
  }
  </code></pre>
  
  <p>I have a similar method for reading the <code>"weather"</code>:</p>
  
  <pre><code>public Weather readWeather(JsonReader reader) throws IOException{
      int id = 0;
      String main         = "";
      String description  = "";
      String icon         = "";
  
      reader.beginObject();
      while (reader.hasNext()){
          String nameToRead = reader.nextName();
          if(nameToRead.equals("id")){
              id = reader.nextInt();
          }else if (nameToRead.equals("main")){
              main = reader.nextString();
          }else if (nameToRead.equals("description")){
              description = reader.nextString();
          }else if (nameToRead.equals("icon")){
              icon = reader.nextString();
          }else{
              reader.skipValue();
          }
      }
      reader.endObject();
      return (new Weather(id, main, description, icon));
  }
  </code></pre>
  
  <p>I keep getting this exception message <code>Expected BEGIN_OBJECT but was BEGIN_ARRAY
  </code></p>
  
  <p>If I change <code>reader.beginObject()</code> to <code>reader.beginArray()</code> I get the same error. I also tried removing it entirely, and the same error occurred.</p>
  
  <p>I'm assuming this is caused by the introduction of the <code>[</code>, but I'm not really sure how to fix this. If anyone has a clue please help, I would really appreciate it, thank you.</p>