-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to iterate over nested json object #1561
Comments
Try for (auto& el : object["response"]["items].items())
{
std::cout << el.key() << " : " << el.value() << '\n';
} More on the items function: https://nlohmann.github.io/json/classnlohmann_1_1basic__json_afe3e137ace692efa08590d8df40f58dd.html#afe3e137ace692efa08590d8df40f58dd |
Thx.
|
But what if in iterator of this case I get another object?
Thats how I organize inner iteration:
|
Is there a way to iterate over a json object without having to know ahead of time how to move up or down the levels of hierarchy in the json object? |
You could use the |
Is there a way to iterate Array of Objects?? I have tried this way but not working:
Thanks in advance. |
Hello.
I got json structure, which I need to parse:
In my c++ program I create json object from string with json:
And then I need to iterate over respones.items. How propertly do this? I want to use 'for' operator:
The text was updated successfully, but these errors were encountered: