public static ArrayList<Actor> fromJson(JSONArray jsonArray, Movie movie) { ArrayList<Actor> actors = new ArrayList<Actor>(jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject actorJSON = null; try { actorJSON = jsonArray.getJSONObject(i); } catch (Exception e) { e.printStackTrace(); continue; } Actor actor = Actor.fromJson(actorJSON, movie); if (actor != null) { actors.add(actor); } } return actors; }