nlohmann::json all = {
{"pi", 3.141},
{"happy", true},
{"name", "Niels"},
{"nothing", nullptr},
{"answer", {
{"everything", 42}
}},
{"list", {1, 0, 2}},
{"object", {
{"currency", "USD"},
{"value", 42.99}
}}
};
for (nlohmann::json::iterator it = all.begin(); it != all.end(); ++it) {
std::cout << it.key() << std::endl;
}
pi
happy
name
nothing
answer
list
object
answer
happy
list
name
nothing
object
pi
Let's say I have the json from the example readme:
I will iterate over it the following way:
I would expect this:
Instead, I get:
Why is this the default? Can it be turned off?