I know there are quite similar questions so far, but I just don't get a right idea sorry.
I would like to convert a complex json to a clean pandas dataframe.
My Code so far:
with open('JSON_Input.json', 'r') as json_file:
json_data = json.load(json_file)
json_data = json.loads(json_data)
This creates the following complex, nested json object:
json_data
{'time': 0,
'day1': [{'time': 0,
'coordinates': [{'x': 1202.5, 'y': 486, 'time': 3276},
{'x': 1162.5, 'y': 484, 'time': 3331},
{'x': 742.5, 'y': 492.5, 'time': 3487},
{'x': 673.5, 'y': 501.5, 'time': 3514},
{'x': 636, 'y': 508.5, 'time': 3539}]},
{'path': 'path1',
'time': 3558,
'coordinates': [{'x': 1237, 'y': 173, 'time': 5437},
{'x': 1240, 'y': 182, 'time': 5601},
{'x': 1260, 'y': 161, 'time': 7289},
{'x': 1263, 'y': 165, 'time': 7465},
{'x': 1482, 'y': 114.5, 'time': 8072},
{'x': 1482, 'y': 114, 'time': 8197},
{'x': 1482, 'y': 126.5, 'time': 9539}]},
{'path': 'path2',
'time': 23620,
'coordinates': [{'x': 227.5, 'y': 420, 'time': 25228},
{'x': 235, 'y': 418, 'time': 25426}]},
{'path': 'path3',
'time': 35891,
'coordinates': [{'x': 681.5, 'y': 431, 'time': 36648},
{'x': 704.5, 'y': 427.5, 'time': 36661},
{'x': 874.5, 'y': 420.5, 'time': 36714},
{'x': 909.5, 'y': 422, 'time': 36734}]}],
'day2': {'path': 'path4',
'time': 36743,
'coordinates': [{'x': 600, 'y': 622.5, 'time': 37390},
{'x': 603, 'y': 594.5, 'time': 37448},
{'x': 605, 'y': 541.5, 'time': 37478},
{'x': 608.5, 'y': 481.5, 'time': 37495},
{'x': 620, 'y': 369, 'time': 37530},
{'x': 624.5, 'y': 329, 'time': 37547},
{'x': 636, 'y': 366, 'time': 38043}]}}
Now how can get a clean dataframe out of this json file?