JSON breaking when it comes to List of Texts

I’m exporting data from my database via JSON through an API. The expression to pull the data from the table written in the standard way:

Parent group’s X’s Y item:trimmed:formatted as JSON-safe.

The problem arises in this formatting:

“Design”: “Randomised”, “Multi-centre”, “Multi-drug”, "Adaptive”,

Because each of the words have their own quotations which are then separated by their own commas the API is throwing errors as it feels it’s missing some parts of the JSON expression.

To fix this, I think I need to have Bubble not use quotation marks on each word which means the full string will be seen as one block of data. How can I achieve this?

If it is a list of text being returned, it is probably expecting an array.

Have you tried adding the list of text within square brackets?

"Design”: [“Randomised”, “Multi-centre”, “Multi-drug”, "Adaptive”]

Yes, with and without square brackets had no change in the outcome.

An array is formatted slightly differently and would’ve started like this:

“Field name”: [{
} etc.

But either way, the data itself is a single field but its formatting of the quotations marks for each text between commas is confusing it.

I understand now, you’re looking for a comma separated list as a single text value.

Rather than formatting each item as JSON-safe in the expression, have you tried just returning each item trimmed (and formatted as text with a comma delimiter), and then formatting the entire result as JSON-safe?

This expression worked for me using my blog data:

This should output a list like: “Randomised,Multi-centre,Multi-drug,Adaptive”


This is solved the issue, thank you!

1 Like