You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is currently no such call in the library. Internally, we use std::map for objects, and I don't know a function to retrieve a map's keys without explicitly iterating over the map and collecting the keys.
I think this is out of scope for a C++ library. There is no "cheap" solution to retrieve a std::map's keys, and a keys() function would hence be an naive loop that copies the keys into a container. And mostly, you would then need to iterate that container again to do anything useful with the keys - and this iteration could also have been done on the object itself, like
for (json::iterator it = myObject["pages"].begin();
it != myObject["pages"].end(); ++it)
{
std::cout << "this is a key: " << it.key() << "\n";
// or do anything else with the key
}
or even nicer:
for (auto it : json::iterator_wrapper(myObject["pages"]))
{
std::cout << "this is a key: " << it.key() << "\n";
// or do anything else with the key
}
I have this in JS:
let myObject = {"pages": {"32746": {"data": "A data"}}};
console.log(myObject.pages[myObject.keys(myObject.pages)])
I readed the API documentation but I don't found this.
I tried with:
j["pages"]["*"]
but don't work.Any help?
The text was updated successfully, but these errors were encountered: