Skip to content

reading/writing nested objects #3434

Discussion options

You must be logged in to vote

but how can I access these values dataRate, fileSize and fileFormat?

json, the default template instantiation of basic_json, uses the STL comtainers std::map for objects and std::vector for arrays. You can access elements accordingly. For instance:
int dataRate = rcvdJSON["master"]["configs"]["mIkjdfuehnduen"]["dataRate"];

I believe the examples section in the README covers everything you're asking:
https://github.com/nlohmann/json#examples

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@mohammedalasmar
Comment options

@falbrechtskirchinger
Comment options

@mohammedalasmar
Comment options

Answer selected by nlohmann
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants