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?
Say I have a people.json
which looks like this:
{"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?
I have worked with python before and my "goal" (which may be ill-set for C++) is to obtain the equivalent of a nested python dictionary.