Skip to main content
Solved

How to loop through array of objects with keys

  • December 30, 2022
  • 5 replies
  • 87 views

Forum|alt.badge.img+4

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

Best answer by Bill_French

This is a little rough, but it might help.

5 replies

Forum|alt.badge.img+19
  • Inspiring
  • Answer
  • December 31, 2022

This is a little rough, but it might help.


Forum|alt.badge.img+4
  • Author
  • New Participant
  • December 31, 2022

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,
}
}
});

Forum|alt.badge.img+8
  • Known Participant
  • December 31, 2022

This is a little rough, but it might help.


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


Forum|alt.badge.img+19
  • Inspiring
  • December 31, 2022

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.


Forum|alt.badge.img+18
  • Inspiring
  • January 8, 2023

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.


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π