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?
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,
Stringify the list
Reference the list as dynamic data
Add a [" before and "] after the string
Find instances of , in the string
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.