Need some guidance or hint in transforming this complex json object to csv. I personally feel that my input data is incorrect or not proper which I designed from my previous flows and obtained this as a result. Any suggestions in modifying my input json object and obtaining the desired result will also be helpful for me.
Note - As here in this example there is one APD in each API, similarly there are many API and APD. Just attached a part of my Json Object.
Input Json Object
{
"API": {
"VendorID": "39594",
"InvoiceName": "December Expenses (12/01/2020)",
"Description": "HectorEchiveste",
"SumInvoiceAmount": 622.02,
"InvAcctDate": "1222021",
"InvAcctDate2": "1222021",
"APD": {
"JobNumber": [
"",
"C8D-27-14387",
"",
"",
"CL5-27-11934",
"CL5-27-11934",
"",
"",
"",
""
],
"CostCode": [
"",
"1000",
"",
"",
"1000",
"1000",
"",
"",
"",
""
],
"CostCategory": [
"",
"M",
"",
"",
"O",
"O",
"",
"",
"",
""
],
"GL": [
"1-20-70-6600",
"1-20-70-5200",
"1-20-70-6600",
"1-20-70-6600",
"1-20-70-5500",
"1-20-70-5500",
"1-20-70-6600",
"1-20-70-6600",
"1-20-70-6600",
"1-20-70-6600"
],
"Amount": [
"60.00",
"166.17",
"51.34",
"60.00",
"67.75",
"9.00",
"45.00",
"48.75",
"50.00",
"64.01"
]
}
},
"API": {
"VendorID": "39849",
"InvoiceName": "December Expenses (12/01/2020)",
"Description": "DonaldOrtega",
"SumInvoiceAmount": 223.08,
"InvAcctDate": "1252021",
"InvAcctDate2": "1252021",
"APD": {
"JobNumber": [
"B8G-87-15555"
],
"CostCode": [
"1000"
],
"CostCategory": [
"M"
],
"GL": [
"1-80-70-5200"
],
"Amount": [
"223.08"
]
}
}
Required Csv format
question from:
https://stackoverflow.com/questions/65943364/unable-to-transform-complex-json-object-to-csv-using-dataweave