Skip to content
Assistance with JSO...
 
Notifications
Clear all

Assistance with JSON Structure Creation

1 Posts
1 Users
0 Reactions
6 Views
fedgery
(@fedgery)
Posts: 1
New Member
Topic starter
 

What are you trying to achieve?

I'm aiming to transform a simple array of URLs into a JSON object. This object should contain an array of collections, where each collection is populated with an image URL and a static field that remains consistent across all entries.

I want to convert this basic array:

Bundle 1 (Collection)
imageSrcArray (Array)
1 URL #1
2 URL #2
3 …

into this structure:

[
{
“imageSrcCollection”: [
{
“imageurl”:“URL #1”,
“param
type”:“IMAGE”,
},
{
“imageurl”:“URL #2”,
“param
type”:“IMAGE”,
}
]
}
]

Steps taken so far

As a newcomer, I've successfully completed various other modules in my automation workflows, including generating AI JSON structures, setting variables, making API calls, and interacting with Excel. However, I'm struggling with this particular task. I've likely consumed hundreds of operations and spent considerable time reviewing YouTube tutorials to find a solution. I'm hoping for a simplified explanation, as if I were a beginner!

I'm currently populating an array using "array add()". This array simply holds image URLs, with each "add()" call appending a new URL. It can accommodate any number of URLs, not just two, though I'm using two for this illustration.

Bundle 1 (Collection)
imageSrcArray (Array)
1 URL #1
2 URL #2
3 …

My goal is to take each of these URLs and construct a JSON structure similar to the one shown below. This structure should be an array containing collections.

I'm having trouble figuring out how to iterate through my imageSrcArray and then create an array that includes two collections within the "imageSrcCollection" array. I suspect the solution involves using JSON modules, but I'm currently lost.

Thank you for any assistance or guidance you can offer!

[
{
“imageSrcCollection”: [
{
“imageurl”:“URL #1”,
“param
type”:“IMAGE”,
},
{
“imageurl”:“URL #2”,
“param
type”:“IMAGE”,
}
]
}
]

 
Posted : 20/01/2025 11:28 pm
Share: