extract sub key data without iterating #2474
JGriff-dev
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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.
Beta Was this translation helpful? Give feedback.
All reactions