title: Iterate Array of JSON objects
body: <p>I am using <code>org.json.simple</code> library to construct <code>JSONArray</code> of <code>JSONObject</code>. So my structure looks like</p>
  
  <pre><code>c= [
    {
      "name":"test",
      "age":1
    },
    {
     "name":"test",
     "age":1
     }
  ]
  </code></pre>
  
  <p>To iterate the array in java, I tried </p>
  
  <pre><code>for (int i = 0; i &lt; c.size(); i++) {
      JSONObject obj = (JSONObject) c.get(i);
      System.out.println(obj.get("name"));        
  }
  </code></pre>
  
  <p>It printed <code>null</code>, but when tried to print the <code>obj.toString</code>, it prints the JSON string as expected.</p>
  
  <p>I am using <code>org.json.simple</code> jar, so cannot use the methods defined <code>org.json.JSONArray</code> or <code>org.json.JSONObject</code>.</p>
  
  <p>Any ideas to get the values from the object with their key? </p>