JSON Object GSON into list
<p>I want to implement my old code when I was populating JSON array into listview but my current json haven't specified array, overall json is an array...</p>

<p>Can somebody tell me how to transform my code to use JSON like this?</p>

<p><a href="https://api-v2.hearthis.at/categories/drumandbass/?page=15&amp;count=2" rel="nofollow">https://api-v2.hearthis.at/categories/drumandbass/?page=15&amp;count=2</a></p>

<p>Code to use gson, my old:</p>

<pre><code>protected List&lt;Model&gt; doInBackground(String... params) {
  HttpURLConnection connection = null;
  BufferedReader reader = null;
  try {
    URL url = new URL(params[0]);
    connection = (HttpURLConnection) url.openConnection();
    connection.connect();
    InputStream stream = connection.getInputStream();
    reader = new BufferedReader(new InputStreamReader(stream));
    StringBuffer buffer = new StringBuffer();
    String line ="";
    while ((line = reader.readLine()) != null){
      buffer.append(line);
    }

    String finalJson = buffer.toString();

    JSONObject parentObject = new JSONObject(finalJson);
    JSONArray parentArray = new JSONArray("arrayname");

    List&lt;Model&gt; dataModelList = new ArrayList&lt;&gt;();

    Gson gson = new Gson();
    for(int i=0; i&lt;parentArray.length(); i++) {
      JSONObject finalObject = parentArray.getJSONObject(i);

      Model modelList = gson.fromJson(finalObject.toString(), Model.class);
      dataModelList.add(modelList);
    }
    return dataModelList;
  } catch (MalformedURLException e) {
    e.printStackTrace();
  } catch (IOException e) {
      e.printStackTrace();
  } catch (JSONException e) {
      e.printStackTrace();
  } finally {
    if(connection != null) {
      connection.disconnect();
    }
    try {
      if(reader != null) {
        reader.close();
      }
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
 return  null;
 }
</code></pre>