I need to flat/normalize very large hierarchical JSON records.
I've tried the examples with json_normalize but I don't know exactly the name of the columns I must pass in the record_path
param exactly the other columns for meta
.
This is a sample of how complicated the JSON record could be:
d2 = {'key2':None,
'a':1 , 'b':{'v':[1,2,3]},
'c': {'c1':'c1', 'c2':'c2'},
'd': {'d1': 1, 'd2':{'d3': 'd3', 'd4': 'd4', 'd5':[3,3,3,4]}},
'key':
{'seqOf': [{'seqOf':
{'dedicatedAccountID': '191', 'campaignIdentifier': None, 'transactionAmount': b'106.670000',
'adjustmentAmount': None, 'accountBalance': b'122.000000', 'accountExpiryDateBefore': None,
'accountExpiryDateAfter': None, 'accountStartDateBefore': None, 'accountStartDateAfter': None,
'mainDedicatedAccountID': None, 'offerIdentifier': None, 'dedicatedAccountUnit': '1',
'transactionUnits': None, 'adjustmentUnits': None, 'unitBalance': None, 'realMoneyFlag': None}
}]}}
I also tried to do for every key and then join the columns, but as I said, the files are really complex. Performance is not an issue, I'm running this offline, I only need a few of those JSON records flattened to CSV.
Is there any automatic tool that would do it?