Pull data from a JSON Array, create a new array with additional data and send to an HTTP call

I am pulling data from one HTTP which returns an array of data like this
"account": "123456", agreementNumbers": [ 9011025347, 2533271868 ]

what I need to do is change that into JSON that looks like this [
{
“accountNumber”:467003, “agreementNumber”: 3196263002
},
{
“accountNumber”:467003, “agreementNumber”: 7008020805
}
]

I’m new to Make, just started using it this week and I cant seem to figure out how to make this work.

Welcome to the Make community!

Please provide the output bundles of the HTTP module by running the scenario, then click the white speech bubble on the top-right of each module and select “Download output bundles”.
Screenshot_2023-10-06_141025

A.

Save the bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.
Uploading it here will look like this:

bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted output bundle in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

Providing the output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

This will allow others to better assist you. Thanks!

2 Likes

HEY @Patrick_Kelly
Welcome To the community
Here I am using a Parse JSON module to get te structure of your JSON
you will have It mapped from your module instead

Use an iterator and map the agreementNumbers Array to it

Next use a text aggregator Module turn on advance options use ,(comma as row separator)
and map the fields following way

Use a set variable and map the data from text aggregator here and make it an array

hope this helps

4 Likes