You should use next code:
JSONArray jsonArray = new JSONArray(response);
JSONObject jsonObject = jsonArray.getJSONObject(0);
Log.d("ID -> ", jsonObject.getString("id"));
Log.d("CAT -> ", jsonObject.getString("cat"));
Because you have not an object in json, but an array, so you should create array instead of object. And thats why your modification works. Because in modified code “data” is an object (JSONObject)
1
solved Android JSON Parse