Hey everybody, this problem has left me scratching my brain so wondering if anyone in the community has a better idea of how to solve this than me. I am using some AI generator APIs and it returns a JSON string of “text”: “text output goes here”.
I want to run this 4 times and then make an array of the 4 “text” outputs ideally following the structure of
[
{
“Outputs”: [
{
“Generated”: “First text output”
},
{
“Generated”: “Second text output”
}
]
}
]
with that being created regardless of if there is just 1 text generated or 2, 3 or 4. I can’t figure out how to get this done with the function node but if someone can point me in the right direction that’d be great.
I’ve tried doing this with a webhook response and then building the json manually but then the json gets broken if there is a linebreak or similar.