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
storing peoples like this
{"Anna" : {
"age": 18,
"profession": "student"},
"Ben" : {
"age" : "nineteen",
"profession": "mechanic"}
}
will cause problems, particularly if differents peoples have same name..
rather use array storing objects like this
{
"peoples":[
{
"name":"Anna",
"age": 18,
"profession": "student"
},
{
"name":"Ben",
"age" : "nineteen",
"profession": "mechanic"
}
]
}
like this, you can enumerates objects, or acces objects by numerical index. remember that json is storage structure, not dynamically sorter or indexer. use data stored in json to build indexes as you need and acces data.