-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Cannot load json file properly #759
Comments
Here are examples from the README: https://github.com/nlohmann/json#tofrom-streams-eg-files-string-streams How does your JSON file look like? What is the error message you encounter? |
Closing due to inactivity. Feel free to comment to this issue if the problem still occurs. |
@PowerOfCreation if you're still around, I'm using ifstream to stream into the JSON object, like in the examples on the readme:
It looks like you're trying to do j << i instead. Perhaps supported by the library, but I haven't tried. |
I couldn't find any example nor documentation on how to load a json file properly. I did it doing so:
ifstream myfile(p.path());
Neither of those variants do work. I can compile it but I get the error cannot use at() with object and same with the [] operator. Only with a iterator I can actually access my values:
for (json::iterator it = j.begin(); it != j.end(); ++it)
But I can't access the subvalues in any way yet as there are no examples or documentations avaiable.
I tried it in many ways:
Are there any examples how to actually load a json file properly or am I doing something wrong?
The text was updated successfully, but these errors were encountered: