I have an application that receives a JSON in the following format:
{
"name": "person name",
"food": {
"fruit": "apple",
"meal": {
"lunch": "burger",
"dinner": "pizza"
}
}
}
However I need to create an Excel (or csv) with that data, and transform that Excel into this format.
I tried to create an dictionary like this:
name,food.fruit,food.meal.lunch,food.meal.dinner
person name,apple,burger,pizza
I am trying to use pandas, but I am not being able to deal with this multi level headers to transform into a python dictionary.
Options
- What is the best way to write this data into an CSV or Excel?
- How to use Pandas to split the headers and convert it into a multi-level nested JSON?