Michael - Hello! Not sure how to do this. I hav...
Hello! Not sure how to do this. I have a loop on a json list, and each loop iteration generates an image url. How can I add the generated image url as an object key on the original json list?
Solution:Jump to solution
Hey, in the body of the loop you can save the json in a temporary file and append the new image url field. For this you can use the "Append Array to JSON File" node. Here's a sample workflow thats looping over an array of countries, getting a city for each one using GPT, then using the aforementioned node to append the new field. It then reads the json and returns it. Hopefully this helps: https://buildship.app/remix/a2bd6f42-d22f-4eb9-a54d-062d71d1f7ed
2 Replies
Solution
Hey, in the body of the loop you can save the json in a temporary file and append the new image url field. For this you can use the "Append Array to JSON File" node. Here's a sample workflow thats looping over an array of countries, getting a city for each one using GPT, then using the aforementioned node to append the new field. It then reads the json and returns it. Hopefully this helps: https://buildship.app/remix/a2bd6f42-d22f-4eb9-a54d-062d71d1f7ed
Oh fascinating -- thank you so much @Luis ! Yeah that's exactly what I was missing.