title: Android (JSONObject) How can get each key
body: <p>If I have a JSON:</p>
  
  <pre><code>{"list_path":{"149":{"1610":{"file":[]},"1599":{"1600":{"1604":{"1605":{"file":[]},"file":[]},"1601":{"1602":{"file":["f485","f484","f482","f481","f480","f479","f478","f477"]},"file":[]},"file":[]},"file":[]},"1609":{"file":[]},"1607":{"file":[]},"1608":{"file":[]},"1606":{"file":[]},"file":[]}}}
  </code></pre>
  
  <p>But I don't know the key. How can I get each key.</p>
  
  <p>I try to use <code>String key = iter.next();</code> but it only can get one key.</p>
  
  <p>Like If I write in 149. I want get 1599, 1606, 1607, 1608, 1609, 1610, file.</p>
  
  <p>Please help me. Thank you.</p>
  
  <pre><code>JSONParser jParser = new JSONParser();
  JSONObject jsons = jParser.getJSONFromUrl("http://ap2.finance.xcom.tw:8080/app/?m=z8Ga37UPPQbEDMxR&amp;mode=get_list&amp;user_id=1");
  
  try {
      JSONObject status = jsons.getJSONObject("list_path");
      Iterator iter = status.keys();
  
      while(iter.hasNext()) {
          String key = (String)iter.next();
          try {
              Object value = jsons.get(key);
          } catch (JSONException e) {
              Log.d( "Json", "hasNext error");    
          }
      }
  } catch (JSONException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
  }
  </code></pre>