Hi, I have an API query and there I get the data in an array {{ api_request.data.Data['0'] }}, in the array data.Data are the objects 0,1,2,3 etc., and there are all the order information, order number, invoice number, address, ordered items, etc.
I want to transfer this data into my SQL database. I manage to transfer each column from the object 0 or 1 individually via the GUI mode, but not the complete array.
Especially because the individual orders are structured like this:
Hi @Konstantin_Kiss Does your database have a separate column for the customer name, customer email, etc?
Are you looking to flatten the api data so that none of it is nested in an array/obj? If so, you could try a flatten strategy like this. You may need to modify the code for your specific column names. Similarly, it sounds like you'll need to modify the mode to check for nested arrays as well.
Something like this could be added to flatten nested arrays of objects:
else if((typeof ob[i]) === 'object' && Array.isArray(ob[i])){
ob[i].map(elm=>{
const temp = flattenObj(ob[i]);
for (const j in temp) {
// Store temp in result
result[i + '.' + j] = temp[j];
}
})
}
I have now solved it differently and get the data individually from the object:
let customerEmail = item.Customer.Email;
let customerName = item.Customer.Name;
let customerNumber = item.Customer.Number;
let customerTel1 = item.Customer.Tel1;