How to format FileIDs in Text Aggregator as clean JSON array for HTTP request?

Hi everyone,

I’m trying to build a flow where I upload multiple files and then send their FileIDs to an OpenAI HTTP request.

I already have all the FileIDs collected in a variable called AllFileIDs. Now I want to use a Text Aggregator to format them as a clean JSON array, like this:

{
  "file_ids": ["file-abc123", "file-def456", "file-ghi789"]
}

But I’m struggling to get the syntax right in the Text Aggregator.

I need each FileID in quotation marks, separated by commas, so the final result can go directly into the HTTP request body.

How can I best achieve this?

Any tips on the correct Text Aggregator settings or alternative approaches would be much appreciated!

Thanks a lot in advance!


Hey there,

can you share the input bundle as well so we can see what it originally looks like?

Hey Stoyan,
thanks for your replie.
The second screenshot is the input bundle.
so basically I have an unclear amount of “all-file-ids” as an array. (also potentially 0)

The best would even be to get the a JSON in the format which I showed above from this Array aggregator, which has a nested structutre, where the file IDS are separated in pdf-file-ids and other-file-ids. (seen in the screenshot attached)
What i get from my current text aggregator (in the other attaced screenshot), is just the file names, without exclamationmar, and the 2 “other files” are not even separated with a space.
How could correct json come out, so i could feed the file IDs to a HTTP request to an OpenAI thread?

Thank you for your help.