I want easily to change a dictionary like this (with arbitrary depth, or let's say, up to 7 levels of nesting) into a tabular data structure:
{u'Adjustment': False,
u'DocNumber': u'2',
u'Id': u'1005',
u'Line': [{u'Amount': 50.0,
u'Description': u'Extra Pay for Cellist for 9/27 Session on "Song Name"',
u'DetailType': u'JournalEntryLineDetail',
u'Id': u'0',
u'JournalEntryLineDetail': {u'AccountRef': {u'name': u'Recorded Music:WIP:Studio Musicians',
u'value': u'99'},
u'Entity': {u'EntityRef': {u'name': u'Some Vendor',
u'value': u'92'},
u'Type': u'Vendor'},
u'PostingType': u'Debit'}},
{u'Amount': 50.0,
u'Description': u'Paid Vendor in Cash for amount over $150 check',
u'DetailType': u'JournalEntryLineDetail',
u'Id': u'1',
u'JournalEntryLineDetail': {u'AccountRef': {u'name': u'3000 Capital Account (contr/withdr)',
u'value': u'7'},
u'Entity': {u'EntityRef': {u'name': 'Some Name',
u'value': u'92'},
u'Type': u'Vendor'},
u'PostingType': u'Credit'}}],
u'MetaData': {u'CreateTime': u'2007-09-27T00:00:00-07:00',
u'LastUpdatedTime': u'2007-09-27T00:00:00-07:00'},
u'PrivateNote': u'General Journal',
u'SyncToken': u'0',
u'TxnDate': u'2007-09-27',
u'domain': u'QBO',
u'sparse': False}
What's the best way to accomplish this. The headers for a nested item of list whose key is u'Line', I'd want the end-state header to be Line[0] - Amount, and the name of the EntityRef of the first Line's JournalEntryLineDetail's Entity to be Line[0] - JournalEntryLineDetail - Entity - EntityRef - name.
I know this would make the table extremely wide if the depth was more than a couple levels, but let's assume that's what I want.
I'm hoping there's a module that just does this. I checked out tablib but haven't figure out how to make it do that yet.