Help

Re: How to loop through array of objects with keys

Solved
Jump to Solution
4378 0
cancel
Showing results for 
Search instead for 
Did you mean: 
seidumohammed64
5 - Automation Enthusiast
5 - Automation Enthusiast

Please how do I loop through a data like this and create a records in airtable 
I got this from an external API and parsed it to json format

array of objects.png

2 Solutions

Accepted Solutions
Bill_French
17 - Neptune
17 - Neptune

This is a little rough, but it might help.

See Solution in Thread

seidumohammed64
5 - Automation Enthusiast
5 - Automation Enthusiast

Thank you @Bill_French 
I did it this way and it worked perfectly

 

let data_items = data['data'];
let data_objects = Object.values(data_items)
 
After getting the objects I used map  to get the fields and created the records in airtable
let actual_data = data_objects.map((key) => {
return {
fields:{
"Id":key.id,
"Name":key.name,
}
}
});

See Solution in Thread

5 Replies 5
Bill_French
17 - Neptune
17 - Neptune

This is a little rough, but it might help.

seidumohammed64
5 - Automation Enthusiast
5 - Automation Enthusiast

Thank you @Bill_French 
I did it this way and it worked perfectly

 

let data_items = data['data'];
let data_objects = Object.values(data_items)
 
After getting the objects I used map  to get the fields and created the records in airtable
let actual_data = data_objects.map((key) => {
return {
fields:{
"Id":key.id,
"Name":key.name,
}
}
});

I see you're still around a little, Bill 🙂

Indeed, I'm here by reference, but not by value. 😉

I'm using Airtable's controversial replacement of its community "blog" to work on a project (code-named Sidebar) which uses Coda as a hyper-loop-like approach for more productive knowledge management with AI. It's very rough at this stage but seems relevant and possibly a more streamlined approach for me to contribute. This (for example) just seems a bit more fun for me, and perhaps more useful to those seeking advice.

sidebar.png

Sorry Bill, this is not much 1 Kudo compared to what you bring here.

I had been interested in CODA from a paying account and I had even been allowed to chat with the essential developer Leandro
who launched, among others, airtable pack but then I had to let CODA sleep to carry on some emergencies for me
to achieve between Airtable and Webflow which was more in line with what I had to deliver responsive on my Students' mobiles.

But I still own this CODA account and I wasn't going to give it up on a whim.

I am very aware of what you are proposing here and I am not giving up on the idea of following your suggestion to participate a little
but I don't think I'll find often free time in January until my airtable <-> webflow pairing has provided my Students with some kind of lifepack.
But I thank you for your always constructive and hopeful engagement to share such a way with us!

oLπ