[ArduinoJSON] Get key of current element when iteration through JsonObject

Hi, I'm using the ArduinoJSON library in my project. I have a JsonObject an iterate through it like this:

for( JsonObject::iterator it = jObject->begin(); it != jObject->end(); ++it ){
  //do something with the current iterator it
}

The problem I'm facing at the moment is, that I need to know whats the key of the current iterator to determine whats to do with the data. Is this possible? How? Here is a description of the API: https://bblanchon.github.io/ArduinoJson/api/ Tanks!

Try this:

JasonObject::iterator it;
for (it = jObject->begin(); it != jObject->end(); ++it ){
  //do something with the current iterator it
  if (<some_condition_is_met>) break;
}

// it now has the value used for the object.
// Of course do not type the < or the >
//

Good Luck!

Thanks for your reply but I don't know how this gets me the value of the key of the current iterator.

But I've found a solution here: https://bblanchon.github.io/ArduinoJson/api/jsonobject/begin_end/ Just use it->key. So simple :D