You can enumerate keys in a JsonObject with iterators. However, if you have a JsonDocument, you first need to cast it to a JsonObject.

For example, here is how you would print all the keys at the root of a JsonDocument:

for (JsonPair kv :<JsonObject>()) {

You could also get the JsonVariant associated with each key with kv.value().

Check out the “Recursive Analyzer” case study in the last chapter of Mastering ArduinoJson to see how you can not only print the root keys and types, but also the nested objects recursively.