forEachJsonObject

fun JsonElement.forEachJsonObject(action: (JsonObject) -> Unit)

Iterates over JsonObject elements within this JsonElement.

Extension function on JsonElement. If this element is a JsonObject, action is invoked once. If it is a JsonArray, action is invoked for each JsonObject element in the array.

Parameters

action

the action to perform on each JsonObject

Throws

if this element is neither a JsonObject nor a JsonArray