extract sub key data without iterating #2474
JGriff-dev
started this conversation in
Show and tell
Replies: 1 comment
|
Glad the implicit conversions made this straightforward - assigning jData["DATA"]["Temperature"] straight into a std::list is exactly the intended usage, and it's covered in the implicit/explicit conversions documentation. Thanks for sharing and for the kind words! This reply was drafted by Claude Code on behalf of @nlohmann, as part of a review of open discussions. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I'm new to nlohmann json and I would first like to congratulate the developer on the best JSON library I've seen, its great!
I've looked for and seen requests for multiple key type functionality, which is something I use a lot. Where a hierarchical object structure is known, accessing it easily & safely can be tedious. I discovered today a very simple way of doing this with this library which I think would merit adding to the documentation. I parse an incoming JSON string containing and object and can extract an array of double values in a sub key using this straight forward method:-
Very simple & safe without having to iterate though each layer of the JSON. The same "is_xxxxxxx()" method can be used to verify any known sub key.
Thanks
John.
All reactions