Parse JSON without key
<p>My basic JSON data structure is this:</p>

<pre><code>[
  {
    "data1":"contents of data1",
    "data2":"contents of data 2"
  },
  {
    "data1":"contents of data1",
    "data2":"contents of data 2"
  }
]
</code></pre>

<p>I tried using <code>JSONArray myJson = new JSONArray(json);</code> </p>

<p>but it gives me: </p>

<blockquote>
  <p>org.json.JSONException: Not a primitive array: class org.json.JSONObject</p>
</blockquote>

<p>I am retrieving the JSON through:</p>

<pre><code>JSONParser jParser = new JSONParser();

// Getting JSON from URL
JSONObject json = jParser.getJSONFromUrl(url);
</code></pre>

<p>And convert it to JSONArray using  <code>JSONArray myJson = new JSONArray(json);</code></p>

<p>Thanks!</p>