I have two java applications. In both of them I am iterating json array using foreach:
JSONArray logList = jobj.getJSONArray("creation_time");
for (Object log : logList) {
}
In one project there is no error, however in the other there is a red line under logList with the error Can only iterate over an array or an instance of java.lang.Iterable
I have the same imports in both projects and I am using Java 8. I am really confused why this is happening.
java.lang.Iterable.ObjectimplementIterableI suggest you to use a standard for.import org.json.JSONArrayin both projectsorg.json.JSONArray.