I'm trying to read in a JSON file. So far I have focused on using the jsoncpp
library. However, the documentation is quite hard to understand for me. Could anyone explain in lay terms what it does?
假设我有一个people.json
,看起来像这样:
{"Anna" : {
"age": 18,
"profession": "student"},
"Ben" : {
"age" : "nineteen",
"profession": "mechanic"}
}
What happens when I read this in? Can I create some sort of data structure people
which I can index by Anna
and Ben
as well as age
and profession
? What would be the data type of people
? I thought it would be something similar to a (nested) map, but map values always have to have the same type, don't they?
我以前使用过python,我的"目标"(对于C++来说可能设置不好)是获得与嵌套python字典等效的内容.