-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Closed
Labels
solution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation
Description
Feature Request
It seems that right now iterating over a json object iterates over it as though it was an array, which is counter intuitive from the C++ perspective, which you would expect to be iterated like a std::map.
I suggest json::as_map() and json::as_array() so that one can do:
void foobar (nlohmann::json js1, nlohmann::json js2)
{
for (auto & x : js2.as_map())
{
foo(x.first, x.second);
}
for (auto & x : js2.as_array())
{
bar(x);
}
}Both would return proxy objects (objects that contain a reference to the original, and different begin() and end() functions.)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
solution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation