Skip to content

access a field with operator[] #2822

Answered by nlohmann
sarikh asked this question in Q&A
Discussion options

You must be logged in to vote

For this use case, you can use the value function (https://json.nlohmann.me/api/basic_json/value/):

int a = req_json.value("aaa", 0);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
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