Cloning static Payloads a dynamic amount of times?

Hi i have a payload that will never change, a simplistic example:
{
“staticExample”: “1”
}
but I would like to clone it a dynamic amount of times, could be 1 could be 10 times, so if I would like to clone it twice, it would turn into:
{
“staticExample”: “1”
}
{
“staticExample”: “1”
}

Any suggestions to achieve this inside a scenario?
I’d prefer to do this without using additional operations, but I don’t see any native make functions to clone anything

1 Like

You can just join the json by newline or whatever you want as a sperator. You should get it as json string or convert it into json string to do so. @L2PKNERD

Regards,
Msquare Automation - Platinum Partner of Make
@Msquare_Automation

1 Like

Do you use a module to achieve this, or do you use Make’s array function called join?

An example would be greatly appreciated

1 Like

Hey @L2PKNERD

You can use join() function in any of the module. So where you are mapping your data, you can use inside that module, no need to use any separate module for this.

We can help you with right example if you share use how the data is coming from your past module. You can just click on a filter after that module and take a snapshot how it appears while you are mapping.

Regards,
Msquare Automation - Platinum Partner of Make
@Msquare_Automation

Hi @L2PKNERD, This is basically what you are looking for.

Since you want the length of the json to be dynamic, you should use a repeater with the dynamic value in the “repeats” entry.
Then you simply use a “Text Aggregator” with the format you want and seperate each iteration by comma or by New Row (depending on your use thereafter).

Here is a very simple logic with your “staticexample” data:


It cannot be done without any operations but it will only cost 2, no matter the number of iterations.
Is that helpful?

Exactly what I was looking for,

I was afraid the repeater would make the entire scenario run, but the aggregator seems to stop it from running through it entirely, thanks man

1 Like