Java - retrieving JSON object values
<p>i have a JSON object which looks something like this:</p>

<pre><code>cb = {"content":[{"name":"abc"}{"name":"bcd"}{"name":"xyz"}...]}
</code></pre>

<p>and i have imported the JSON library as:</p>

<p><code>import org.json.JSONObject;</code></p>

<p>Now i want to use a for loop to retrieve the values of name in each of the sub objects...</p>

<pre><code>for(int x = 10; x &lt; numberOfSubElemtnts; x = x+1) {
     //print out the name values
  }
</code></pre>

<p>Output should be:</p>

<p>abc</p>

<p>bcd</p>

<p>xyz</p>

<p>How should I evaluate the length of the array and print out the name values?</p>