I want to write a complex List of dictionaries to a file. Below is my list of dictionaries:
[
{
"Year": "2015",
"Movies": {
"type": "Horror",
"Total Hours": "3",
"Trimmed": 3000,
"List": [
{
"date": "20/10/15",
"time": "10:00:00",
"type": "Horror",
"text": "abcjsaadasd",
"start": 00:00:00,
"end": 02:59:13
"Hero":"asfaf"
},
{
"date": "22/10/15",
"time": "11:00:00",
"type": "Horror",
"text": "sdvsdnsdfa",
"start": 00:00:00,
"end": 02:55:10,
"Hero":"dsvsfs"
}
]
}
},
{
"Year": "2016",
"Movies": {
"type": "Thriller",
"Total Hours": "3",
"Trimmed":100,
"List":[]
}
}
]
I know how to write to a file in Python but I don't know how to parse this kind of complex list of dictionary.
Also I need to check for the List and If it is empty I should erase that dictionary(Eg: The second dictionary present in the above data).
Please help me to solve this issue.Thanks a lot!