It is possible to use pandas.io.json.json_normalize to read from a nested json file. Is it possible to write a nested json from a pd.DataFrame where the columns have appropriate name?
MWE (from the doc of the linked page):
>>> from pandas.io.json import json_normalize
>>> data = [{'id': 1, 'name': {'first': 'Coleen', 'last': 'Volk'}},
... {'name': {'given': 'Mose', 'family': 'Regner'}},
... {'id': 2, 'name': 'Faye Raker'}]
>>> df = json_normalize(data)
id name name.family name.first name.given name.last
0 1.0 NaN NaN Coleen NaN Volk
1 NaN NaN Regner NaN Mose NaN
2 2.0 Faye Raker NaN NaN NaN NaN
>>> # Here I would like to do "to_json_normalize(df)" to recover "data"