title: How to iterate over this json array in java
body: <pre><code>["[{\"timeFrom\":\"06:00:00\",\"timeTo\":\"09:00:00\",\"title\":\"First\"},{\"timeFrom\":\"09:00:00\",\"timeTo\":\"12:00:00\",\"title\":\"Second\"},{\"timeFrom\":\"12:00:00\",\"timeTo\":\"16:00:00\",\"title\":\"Third\"},{\"timeFrom\":\"16:00:00\",\"timeTo\":\"20:00:00\",\"title\":\"Fourth\"},{\"timeFrom\":\"20:00:00\",\"timeTo\":\"21:30:00\",\"title\":\"5th\"},{\"timeFrom\":\"21:30:00\",\"timeTo\":\"00:00:00\",\"title\":\"Dessert (within two hours of bedtime)th\"}]"]
  </code></pre>
  
  <p>I got this array when I log JSONArray. How can I iterate over it and get those values ?</p>
  
  <p><strong>edit</strong></p>
  
  <pre><code>for (int i = 0; i &lt; MyService.Meals.length(); ++i) { 
  JSONObject rec = MyService.Meals.getJSONObject(i); String text = rec.getString("timeFrom"); 
  }
  </code></pre>
  
  <p>Doesn't return anything because MyService.Meals.length() = 1.</p>
  
  <p>MyService.Meals is JSONArray instance</p>