How to send an array from bubble to API in JSON format to backend?

So in my app I have the option to select and deselect multiple elements. What I want is to send the selected elements in array format along with some other elements in JSON format to my backend via the POST api.

For example :-
Let’s say there are 4 options A,B,C,D and the user selects (via clicking) C and D.
So I want the api request body to be something like :-
{
“name”: “username”,
“selected_options”: [
“C”,
“D”
]
}

Note that this is a part of a complete workflow and the post request will be send in the end.
Right now I’m storing the option data in the form of custom states, but I do not know how to convert it to an array or something similar.

Use JSON on front end. There are multiple plugins for this. An easy to use plugin costs $14 once. I don’t recall the name but I’m using it for this exact use case.

You can just use ‘format as text’ on the list of selected options, then format them as needed for your API call.

Where is the format as text option, right now I am using custom states to check if option is clicked or not.
Thanks for reply

thanks for the reply.

format as text is a list operator, so it can be used on any list.

Presumably, your custom state is a list (of the selected options), so ‘format as text’ can be used directly on the custom state.