Replies: 1 comment 4 replies
-
If that is your actual JSON text, then you have an array of single element objects, not a object with six elements. As such, you need to access by array index first. If your JSON text was this, then you could access it as you describe.
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a json string, jsonStr, as below:
[{“first”:123.321},{“second”:456.654},{“third”:789.987},{“fourth”:135.531},{“fifth”:246.642},{“sixth”:0}]
jsonStr is of json data type.
I am trying to access a particular value using the corresponding key but the code breaks with an exception e06d7363.
The C++ code where the program breaks is:
std::cout << “jsonStr[first]: “ << jsonStr[“first”] << std::endl;
It looks pretty straightforward so I don’t understand where I am going wrong. Can someone please help me in this.
Let me know if more information is needed.
Beta Was this translation helpful? Give feedback.
All reactions