I would like to use the Boost (Property Tree) library to parse the following valid JSON file:
{
"user": {
"userID": "5C118C8D-AA65-49C0-B907-348DE87D6665",
"dateProperty": "05-06-2015"
},
"challenges": [
{
"question#1": "answer",
"value": 5
},
{
"question": "answer",
"value": 5
},
{
"question": "answer",
"value": 5
},
{
"question": "answer",
"value": 5
},
{
"question": "answer",
"value": 5
},
{
"question": "answer",
"value": 5
},
{
"question": "answer",
"value": 5
},
{
"question": "answer",
"value": 5
},
{
"question": "answer",
"value": 5
},
{
"question": "answer",
"value": 5
}
] }
I did validate that the JSON format was correct.
I have also consulted with several site such as:
- Boost 1.46.1, Property Tree: How to iterate through ptree receiving sub ptrees?
- http://www.technical-recipes.com/2014/using-boostproperty_tree/
But I still did not get the proper results. I would like to collect the "user" and "challenges" as key/value pairs. The best result would be to write the "challenges" (question/answers) and user info (userID, dateProperty) into a std::pair that can be written into a std:map.
Any suggestions would be appreciated?