Hi,
In python I have a complex object hierarchy made of lists and dictionaries. I want to spit it all out to CSV or some other kind of database format. Any answers in Python or Javascript very much appreciated.
I understand that one CSV file (or table) can only represent one 'level' of object in my hierarchy, so the solution would need to create multiple files.
Here is an example:
{
"Person" : [{"name":"Greg","age":"35","car":["honda civic","ford focus"]},
{"name":"Steve","age":"28", "car":["mazda 323", "toyota camry"]}]
}
would become
Person.csv:
id,name,age
1,Greg,35
2,Steve,28
car.csv:
id,Person_id,value
1,1,honda civic
2,1,ford focus
3,2,mazda 323
4,2,toyota camry
Basically the only thing interesting going on here is the assignment of new ids so that the rows in the tables can be associated.
Cheers, Dave