Working with array manipulation

Hello guys,

I get an array with param X and i want to insert the value in other array at param Y among with a static data.

For ex this is the array structure:

[
    {
        "modifiedon": "2024-02-07T13:49:53.000Z",
        "telephone1": "0501234567",
    },
    {
        "modifiedon": "2024-02-05T09:05:16.000Z",
        "telephone1": "0507654321",
    }
]

I need to combine the phone value into a specific campaign id and send a bulk request, like this:

[
        {
                "Campaign":"AbcdefgHIJKLMNop",
                "Target":"0501234567"
        },
        {
                "Campaign":"AbcdefgHIJKLMNop",
                "Target":"0507654321"
        }
]

How do you recommend to do that?

Hello!

you can use an Iterator to split the array into individual bundles. Then, you add a JSON/Create Json module, and you create a target Data Structure (with an array of collection). You don’t need to finish its configuration yet, just click OK.

Then, before the Create a Json module, you add an Array Aggregator. For the Source, select the Iterator, and for the destination, select the Array from your target Data Structure. (It will Appear ONLY if you have put the Create JSON before the Array Aggregator, so don’t forget to add it before the Array Aggregator).

And you can map the phone numbers to “Target”, and type the “Campaign” by hand.

When you are done with the Aggregator, go back to the JSON/Create Json, and map the Array from the aggregator.

It looks like this:





Give it a try. If you are stuck, let me know.

Benjamin

1 Like

Thanks Benjamin! I managed to do that only with “Aggregate to JSON”

image


image

4 Likes

Oh you already had bundles, fine!
It’s even better with Aggregate to JSON, well done!

Benjamin

1 Like