-
-
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
Add nested object capability to pointers #323
Comments
I can confirm your observation - however, Using |
Of course, doh! Thanks, I'm dealing with a complex structure and the ability to not have to parse/check the existence of each level is quite helpful. |
Also, don't know if you saw my comment on #278, but there is a parallel issue with j.value("/this/that"_json_pointer, 27); should return 27 if either Thx. |
Presumably it's "/this/that"_json_pointer that's throwing, not .value() itself. |
Thanks for noting. The reason is that both functions use the same function inside the |
Got it. Didn't dive inside, it was late :) |
The bug was that there was no code to cope when a JSON pointer was used on a |
I fixed the issue with |
Let's discuss the semantics of @clwill - Can you please have a look at branch https://github.com/nlohmann/json/tree/feature/issue323 if this fixes the issue? |
I've done some playing with the branch above, and it seems to work as expected. I like it! |
BTW, just so you can understand my use case... I have a generic configuration module that puts all the other modules' defaults into one master .json file. The value setting function used to be:
Which worked and was OK. But with this update, I can do:
The modules setting a value can now not only pass in a Thank you. |
Great. I shall merge the branch by the end of the week. However, I have no release date for 2.0.6 yet. |
Thanks! Timing's OK, I can live with the |
Merged the feature branch to develop. |
You currently can create a new object with
and if
this
and/orthat
don't exist, it's all good, it createsthis
as an object and putsthat
in it.But if you use pointers (e.g.
"/this/that"
) it throws an exception ifthis
doesn't exist.For example:
would be nice.
The text was updated successfully, but these errors were encountered: