forEach

fun JSONArray.forEach(operation: (Any) -> Unit)
fun JSONObject.forEach(action: (String, Any?) -> Unit)

Performs the given action on each element.