Possible to POST parameters as an array with Bubble Connector?

I’m using the Bubble Connector to POST a data (as json) to an external endpoint. All the parameters are currently sent as strings, and I’m hitting limit such that the strings can be max 4000 characters.

Is there a way to POST the parameters as an array rather than a string?

Currently the JSON POST strings together all the first_names, last_names as a single string
–data ‘{ “algorithm”: “Roommate”,
“first_name”: “FN1, FN2, FN3, FN4”,
“last_name”: “LN1, LN2, LN3, LN4”

I’m instead looking to send the data as such
–data ‘{ “algorithm”: “Roommate”,
“first_name”: [ “FN1”, “FN2”, “FN3”, “FN4” ],
“last_name”: [ “LN1”, “LN2”, “LN3”, “LN4” ]

My parameter fields are currently comma-separated lists. Any way to convert these to an array?

Hey @kramwe,

You could use the :find and replace module to format the list to your desired format, you may just have to stringify the list before you do so. :slight_smile:

Geez, I wish that worked, but to your comment, :find/replace it would need to operate on the entire string. If I add another :find/replace it to the end of the Search for, it’s operating on the individual elements.

@kramwe To start with FN1, FN2, FN3, FN4 and end with [ “FN1”, “FN2”, “FN3”, “FN4” ], you could use a series of manipulations using :find and replace to make it happen.

For example,

  1. Stringify the list
  2. Reference the list as dynamic data
  3. Add a [" before and "] after the string
  4. Find instances of , in the string
  5. Replace with ", in the string

You may have to address some edge cases but it shouldn’t be an issue if you can reliably anticipate the data formatting, which is where Regular Expressions are helpful at scale. :wink:

How do I stringify the list? Storing it first might work. I’ll try that. If you have a better idea, I’m all ears.

damn. was a good idea, but bubble wraps it in quotes.

“first_name”: " [ “FN1”, “FN2”, “FN3”, “FN4” ] ",