Simple aggregation causes invalid json

Getting “Source is not valid JSON” on a valid json

Could someone explain why this simple example fails to parse a numeric array into json?

The exact same json turns valid if you add the values directly and not through the input array.
JSON string = { "Test": [1, 2, 3] }

Here is my blue print:
JSON From Aggregator.json (4.0 KB)

Hello @JDM_Devs,

What you’re seeing is the text representation of the array object, but the object itself within that text isn’t JSON that can be parsed.
You might consider building your JSON with a Text Aggregator instead.

Something like this (though I know it’s problematic if the text contains certain characters):
JSON From Aggregator (Text Agg).json (5.0 KB)

I am curious on others’ thoughts as well!

1 Like

Welcome to the Make community!

Wrong

Correct

Output

Screenshot_2024-06-24_120631

You need to convert the array into a string. This is because ParseJSON expects the entire variable to be a string.

To convert an array into a string, usually you want to use the built-in function join

For more information, see the function documentation in the Help Center.

Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

General

Help Center Basics

Articles & Videos

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!

3 Likes

Ahh duh map() and join()!

2 Likes

Thanks. I tested the join but not properly it seems.

2 Likes