I am building one app in which I request a PHP file from server. This PHP file returns a JSONArray having JSONObjects as its elements e.g.,
[ {
We can use iterator to filter out the array entries instead of creating a new Array. 'public static void removeNullsFrom(JSONArray array) throws JSONException { if (array != null) { Iterator iterator = array.iterator(); while (iterator.hasNext()) { Object o = iterator.next(); if (o == null || o == JSONObject.NULL) { iterator.remove(); } } } }'