I have a JSON file with multiple dictionaries:
{"team1participants":
[ {
"stats": {
"item1": 3153,
"totalScore": 0,
...
}
},
{
"stats": {
"item1": 2123,
"totalScore": 5,
...
}
},
{
"stats": {
"item1": 1253,
"totalScore": 1,
...
}
}
],
"team2participants":
[ {
"stats": {
"item1": 1853,
"totalScore": 2,
...
}
},
{
"stats": {
"item1": 21523,
"totalScore": 5,
...
}
},
{
"stats": {
"item1": 12503,
"totalScore": 1,
...
}
}
]
}
In other words, the JSON has multiple keys. Each key has a list containing statistics of individual participants.
I have many such JSON files, and I want to extract it to a single CSV file. I can of course do this manually, but this is very tedious. I know of DictWriter, but it seems to work only for single dictionaries. I also know that dictionaries can be concatenated, but it will be problematic because all dictionaries have the same keys.
How can I efficiently extract this to a CSV file?