How can wrap the items in each array in speechmarks, without iterating through each separate array and using a text aggregator to do that? There must be a simple way to apply some formatting to the items in each array?
I’m extracting the list of IDs that populate each array in a map() function so if I can add the speechmarks while extracting the IDs, that’d also solve my problem.
Ultimately, I need to send the arrays as valid JSON in a webhook response.
If I understand it well, you are getting this JSON file (with an incorrect format) as a String and you want to add the speechmarks before you can return it in the payload of your webhook response?
How did you get this json? Maybe there is something we can do before to avoid this format?
If ever it’s not possible to correct this initial data, we could still use regular expressions to correct it.
The json is coming from a list of Notion page IDs that I’ve fetched in a previous step, which I then aggregate into groups of arrays in an array aggregator step.
Maybe you could use a Text Aggregator instead of the Array aggregator so that you have more control over the Json doc you want to build. I’m just wondering, you have 2 arrays in your document; does it mean you have to generate the 2?
And if ever there is no simple way to do it; I have an ugly solution with replace functions and regex. I started to test, it’s possible we can do it combining 3 replace functions, but I need to see the raw JSON that you get. The one you give here seems to have extra carriage returns.
So, eventually, can you show me more how you have generated the first JSON (I mean before the set Variable), and/or can you send a raw version of the JSON you are trying to correct, so that I can try with regex?