The right way to work with arrays; Push, Pull items

Hi, I’m new here and to Make.com. I’m a developer, and working with visual tools makes me feel uncomfortable, but I’m determined not to give up :slight_smile:

I’m here because, after reading through documentation and watching tutorials, I still couldn’t find information about the absolute basics of this tool. Specifically, I’m struggling with managing a simple array.

Here’s my question: I’ve created an array of objects, and since I need to modify each of them, I set up an iterator, which in my “world” would be like a simple “for” loop. Inside the iterator, I used “createJson” and then “parseJson,” but despite trying countless different approaches, I haven’t had any success.

In the end, I used an “array aggregator,” which gave me this result—an array with my 3 items correctly created.

an array with my 3 items correctly created

After the aggregator, I added another “CreateJSON” step, sending the array from the “array aggregator,” which resulted in a JSON string:

Now, what I need to understand is how I can push another object into this array.

Basically, I want to know how to push an object into an array of objects and how to delete a specific item from an array.

Sorry if this question seems silly, but it feels like it’s easier to create an automation with an AI creating an auto publish in websites and social networks than to perform a simple push or pull into an array!

Any help would be greatly appreciated!

Welcome to the Make community!

To allow others to assist you with your scenario, please provide the following:

1. Output Bundles of Modules

Please provide the output bundles of the module containing the JSON by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.

A. Upload as Text File

Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

B. Insert as Formatted Code Block

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles.
These are the two ways to format text so that it won’t be modified by the forum:

  • Method 1: Type code block manually

    Add three backticks ``` before and after the content/bundle, like this:

    ```
    content goes here
    ```

  • Method 2. Highlight and click the format button in the editor

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

Following these steps will allow others to assist you here. Thanks!

Hi, thank you for suggestion, I will follow the procedure :slight_smile:

After much trial and error, I finally found a solution to achieve the results I wanted, specifically adding a “complex” object into an array of complex objects. I’m sharing the blueprint here, and I’d like to know if this is the best approach to accomplish this.

blueprintJsonArrayPushEasier.json (7.8 KB)

As you know, even in coding, there are many ways to achieve the same result. I’d appreciate your feedback on whether this is the right approach.

Thank you again for your help!

1 Like

Yes, that’s one way to do it, but you don’t really need a Create JSON module if you just put the JSON in the “Parse JSON” module, saving an operation.