How to create mapping this array?

How to create mapping this array?

From

[
{
“array”: [
{
aiImagePrompts”: [
“Create a realistic, cinematic image of the hybrid entity awakening, its eyes glowing brightly as it releases tendrils of vivid energy curling into intricate, mesmerizing shapes. The background should reflect a fusion of light and darkness, showcasing the dynamic interplay of the energy being emitted.”,
“Create a realistic, cinematic image of a cosmic entity coming to life, with bright tendrils of energy bursting forth from its form, intertwining in beautiful patterns. The setting should visually represent a blend of luminous light and swirling shadows as the entity expands its conscious presence.”,
“Create a realistic, cinematic image of a striking hybrid being illuminating the void, with glowing tendrils of energy twisting gracefully through the air, creating enchanting shapes. Capture the essence of light and shadow coalescing in the background, enhancing the scene’s magical atmosphere.”
],
aiVideoPrompts”: [
“Animate the awakening of a hybrid entity in a vibrant cosmic void, showcasing the gradual unfurling of its consciousness as tendrils of glowing energy spiral outward, morphing into beautiful shapes.”,
“Create a video depicting the moment the entity awakens, with streams of energy surging from its core and twisting in slow-motion, illustrating the dance between light and shadow in mesmerizing forms.”,
“Show an animated sequence of the hybrid being’s consciousness coming alive, tendrils of energy flowing outward, curling, and twisting as they take shape, emphasizing the enchanting transformation in the ethereal setting.”
]
}
]
}
]

To

[
{
“array”: [
{
aiImagePrompt”:
“Create a realistic, cinematic image of the hybrid entity awakening, its eyes glowing brightly as it releases tendrils of vivid energy curling into intricate, mesmerizing shapes. The background should reflect a fusion of light and darkness, showcasing the dynamic interplay of the energy being emitted.”,
aiVideoPrompt”: “Animate the awakening of a hybrid entity in a vibrant cosmic void, showcasing the gradual unfurling of its consciousness as tendrils of glowing energy spiral outward, morphing into beautiful shapes.”
},
{
aiImagePrompt”: “Create a realistic, cinematic image of a cosmic entity coming to life, with bright tendrils of energy bursting forth from its form, intertwining in beautiful patterns. The setting should visually represent a blend of luminous light and swirling shadows as the entity expands its conscious presence.”,
aiVideoPrompt”: “Create a video depicting the moment the entity awakens, with streams of energy surging from its core and twisting in slow-motion, illustrating the dance between light and shadow in mesmerizing forms.”},
{
aiImagePrompt”:
"Create a realistic, cinematic image of a striking hybrid being illuminating the void, with glowing tendrils of energy twisting gracefully through the air, creating enchanting shapes. Capture the essence of light and shadow coalescing in the background, enhancing the scene’s magical atmosphere.”,
aiVideoPrompts”: “Show an animated sequence of the hybrid being’s consciousness coming alive, tendrils of energy flowing outward, curling, and twisting as they take shape, emphasizing the enchanting transformation in the ethereal setting.”
}
]
}
]

I found the method is

Steps to Handle This Input in Make.com:

  1. Input JSON:

Ensure your input JSON data is received by the scenario, either through:

• A Webhook module.

• A JSON Module or similar input module.

  1. Extract the array Object:

Use a Set Variable or similar operation to extract the array from the JSON:
[
{
“aiImagePrompts”: [
“First image prompt”,
“Second image prompt”,
“Third image prompt”
],
“aiVideoPrompts”: [
“First video prompt”,
“Second video prompt”,
“Third video prompt”
]
}
]

  1. Iterator Module:

Use the Iterator module to iterate through one of the arrays (e.g., aiImagePrompts). This will process each prompt individually.

Source Array: aiImagePrompts.

• For each item in aiImagePrompts, retrieve the corresponding item in aiVideoPrompts by index.

  1. Pair Prompts:

Use the Set Variable module (or a custom mapping logic) to pair each aiImagePrompt with its corresponding aiVideoPrompt:

Output Structure:
{
“aiImagePrompt”: “{{aiImagePrompts[n]}}”,
“aiVideoPrompt”: “{{aiVideoPrompts[n]}}”
}

  1. Array Aggregator:

After processing all the elements, use the Array Aggregator module to combine the paired prompts into the final desired structure:
[
{
“aiImagePrompt”: “First image prompt”,
“aiVideoPrompt”: “First video prompt”
},
{
“aiImagePrompt”: “Second image prompt”,
“aiVideoPrompt”: “Second video prompt”
},
{
“aiImagePrompt”: “Third image prompt”,
“aiVideoPrompt”: “Third video prompt”
}
]

-------------- Close ----------------------------

2 Likes