Saving an array of jsons as a variable

Hello
I’m getting an output from AI in the following format:

I get multiple of these throughout one run, and I want to combine them into a variable as a parsed json.
If I use Parse JSON and then save it - I have to save it field by field, and the result is just an array of strings in my variable.

How can just concatinate these outputs as a json objects so I can later iterate them and aggregate by a specific field?

Thank you

Welcome to the Make community!

To allow us to assist you with your output bundle, please provide the following:

Please provide the output bundles of the modules 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.

This will allow others to better assist you. Thanks!

Hope this helps! Let me know if there are any further questions or issues.

@samliew


P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!

Attaching as code block
I’ve replaced content with dots though.

[
    {
        "$1": "\n[\n  {\n    \"helper\": \"....\",\n    \"helped\": \"...\",\n    \"how\": \"...\",\n    \"details\": \"....\",\n    \"score\": 8,\n    \"helper_rep_name\": \"...\",\n    \"helper_rep_phone\": \"+XXX\",\n    \"helped_rep_name\": \"...\",\n    \"helped_rep_phone\": \"+XXX\"\n  },\n  {\n    \"helper\": \"...\",\n    \"helped\": \"...\",\n    \"how\": \"...\",\n    \"details\": \"....\",\n    \"score\": 8,\n    \"helper_rep_name\": \"...\",\n    \"helper_rep_phone\": \"+XXX\",\n    \"helped_rep_name\": \"...\",\n    \"helped_rep_phone\": \"+XXX\"\n  }\n]\n"
    }
]

It looks like it isn’t being formatted here, but let me know

Will be happy to get a response

You need to use aggregate to text and then use Parse JSON

Welcome to the Make community!

Yes, that is possible. You’ll need a minimum of four modules:

Example Output

This is just an example. Your final solution may or may not look like this depending on your requirements.

Module Export - quick import into your scenario

You can copy and paste this module export into your scenario. This will import the modules (with fields/settings/filters) shown in my screenshots above.

  1. Move your mouse over the line of code below. Copy the JSON by clicking the copy button on the right of the code, which looks like this:

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the editor.

  3. Click on each imported module and re-save it for validation. There may be some errors prompting you to remap some variables and connections.

JSON module export — paste this directly in your scenario

{"subflows":[{"flow":[{"id":54,"module":"json:ParseJSON","version":1,"parameters":{"type":""},"mapper":{"json":"[\n    {\n        \"$1\": \"\\n[\\n  {\\n    \\\"helper\\\": \\\"....\\\",\\n    \\\"helped\\\": \\\"...\\\",\\n    \\\"how\\\": \\\"...\\\",\\n    \\\"details\\\": \\\"....\\\",\\n    \\\"score\\\": 8,\\n    \\\"helper_rep_name\\\": \\\"...\\\",\\n    \\\"helper_rep_phone\\\": \\\"+XXX\\\",\\n    \\\"helped_rep_name\\\": \\\"...\\\",\\n    \\\"helped_rep_phone\\\": \\\"+XXX\\\"\\n  },\\n  {\\n    \\\"helper\\\": \\\"...\\\",\\n    \\\"helped\\\": \\\"...\\\",\\n    \\\"how\\\": \\\"...\\\",\\n    \\\"details\\\": \\\"....\\\",\\n    \\\"score\\\": 8,\\n    \\\"helper_rep_name\\\": \\\"...\\\",\\n    \\\"helper_rep_phone\\\": \\\"+XXX\\\",\\n    \\\"helped_rep_name\\\": \\\"...\\\",\\n    \\\"helped_rep_phone\\\": \\\"+XXX\\\"\\n  }\\n]\\n\"\n    }\n]"},"metadata":{"designer":{"x":170,"y":-1767,"name":"Output Bundle"},"parameters":[{"name":"type","type":"udt","label":"Data structure"}]}},{"id":56,"module":"builtin:BasicAggregator","version":1,"parameters":{"feeder":55},"mapper":{"$1":"{{54.`$1`}}"},"metadata":{"designer":{"x":413,"y":-1766}}},{"id":57,"module":"json:ParseJSON","version":1,"parameters":{"type":""},"mapper":{"json":"{\"arrays\":[\n{{replace(join(map(56.array; \"$1\"); \",\"); \"/\\s*\\n+\\s*/g\"; emptystring)}}\n]}"},"metadata":{"designer":{"x":656,"y":-1768,"name":"Parse JSON"},"parameters":[{"name":"type","type":"udt","label":"Data structure"}]}},{"id":58,"module":"util:SetVariable2","version":1,"parameters":{},"mapper":{"name":"items","scope":"roundtrip","value":"{{flatten(57.arrays)}}"},"metadata":{"designer":{"x":901,"y":-1768,"name":"Flatten Array"}}}]}],"metadata":{"version":1}}

Note: Did you know you can reduce the size of blueprints and module export code like the above, using the Make Blueprint Scrubber?

Hope this helps! Let me know if there are any further questions or issues.

@samliew


P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!