title: JSON Array iteration in Android/Java
body: <p>I am building an android app that needs to download and synchronise with an online database, I am sending my query from the app to a php page which returns the relevant rows from a database in JSON format. </p>
  
  <p>can someone please tell me the best way to iterate through a JSON array?</p>
  
  <p>I receive an array of objects:</p>
  
  <p><code>[{json object},{json object},{json object}]</code></p>
  
  <p>What is the simplest piece of code I could use to access the JSONObjects in the array?</p>
  
  <p>EDIT: now that I think of it the method I used to iterate the loop was:</p>
  
  <pre><code>for (String row: json){
       id = row.getInt("id");
       name = row.getString("name");
       password = row.getString("password");
  }
  </code></pre>
  
  <p>So I guess I had was somehow able to turn the returned Json into and iterable array. Any Ideas how I could achieve this?</p>
  
  <p>I apologise for my vaguness but I had this working from an example I found on the web and have since been unable to find it.</p>