title: How to get the first object in an JSONObject without knowing the name?
body: <p>I've a <code>JSONObject</code> that contains other objects:</p>
  
  <pre><code>{
  "1" : {
          "state": [],
          "hue": 224
        }
  "2" : {
          "state": [],
          "hue": 224
        }
  "3" : {
          "state": [],
          "hue": 224
        }
  }
  </code></pre>
  
  <p>It's the response from the Philips Hue Brigde JSON that contains all the connected lights. I use Volley for the http connection.
  I created a Light class where I store the data like state, hue, bri etc. I fill the Light class by using of a for loop in the onResponse from Volley:</p>
  
  <pre><code>for (int i = 0; i &lt;= response.length(); i++) {
       JSONObject lightObject = response.getJSONObject(String.valueOf(i)); 
       System.out.println("OBJECT " + lightObject);
  
       // Use try/catch because of empty or unknown key
                  try {
                      description = lightObject.getString("type");
                  } catch (Exception e) {}
                  try {
                      bri = lightObjectState.getInt("bri");
                  } catch (Exception e) {}
  
                  try {
                      sat = lightObjectState.getInt("sat");
                  } catch (Exception e) {}
  
                  try {
                      hue = lightObjectState.getInt("hue");
                  } catch (Exception e) {}
  
       Light light = new Light(String.valueOf(i),lightObject.getString("name"), description, on, bri, sat, hue);
       mLightList.add(light);
       mLightAdapter.notifyDataSetChanged();
  
  }
  </code></pre>
  
  <p>The problem with the for loop is that, when the Light id starts with greater then zero, it will crash my Android app, because there is <code>no value of 0</code>.
  My question is how I can get the first object of the response without knowing the <code>key</code> name that contains the object with all the properties of one light, so when the <code>JSONObject</code> looks like below, the app will not crash, but just display light 4 till 6:</p>
  
  <pre><code>{
  "4" : {
          "state": [],
          "hue": 224
        }
  "5" : {
          "state": [],
          "hue": 224
        }
  "6" : {
          "state": [],
          "hue": 224
        }
  }
  </code></pre>
  
  <p>If there are any questions left, please let me know.
  Thanks.</p>