title: Access zeroth index of a JSON array in Android
body: <p>I have a JSON response like this:</p>
  
  <pre><code>{"response": 
  {"legislators": 
      [
          {"legislator": 
              {
                                 "fax": "", "name": "John Doe"
              }
          }
      ]
  }
  }
  </code></pre>
  
  <p>There is only 1 element under the legislator array. I've tried to access it using the zeroth index, but I've not been able to. I get an "org.json.JSONException: Index 0 out of range [0..0)". What am I doing wrong?</p>
  
  <pre><code>                        JSONObject response = jsonObject
                              .getJSONObject("response");
                      JSONArray legislators = response
                              .getJSONArray("legislators");
                      JSONObject first = legislators..getJSONObject(0).getJSONObject("legislator");
  
                      Log.i("Kuscco", "" + first.getString("name"));
  </code></pre>