When I was trying to parse a json array, the studio gave me a compilation error stating foreach is not applicable for json array. Although
Because JSONArray derives from Object and foreach expects the collection to be iterable.
JSONArray
Object