How to handle array of string in API call

Hey bubble community!

I have an API call (Get) that will return the following JSON:

“capabilities” and and “channel_type” are not well recognized as list in the bubble API connector. It will only retrieve the first value of the list.


Is there a workaround to retrieve all the information?

Thank you!

That’s not telling you that only the first item will be recognized. That’s telling you that the data values will be interpreted as lists of text type.


capabilities **(list)**

assigned to type text, means that capabilities will be a list of texts (that is, it will be an array of strings).

Now, the weird thing is that, conceptually, the “capabilities” parameter on your API response object is a scalar (single) value. It just happens to hold an array. The elements of this array (which we might call singularly a “capability” may or may not be defined as such). In the past, there was no such thing as a singular capability, but there’s evidence that this might have changed in more recent Bubble versions. Either way, the exact behavior in this situation is not explicitly documented.

With it being an array of strings (OR List of texts in bubble’s jargon) It allows you to enjoy a few extra features with your texts.
Like you can grab the first item, or the last text string from this array, also you can access any specific position’s text, and if you want all of them to be in a single text, you can use format as text for that list, and it will concatenate them in a single string.

BUT … it only works if the nice developer at the other end puts everything in the same format in the array.

Bubble looks at the first item (and only the first item) and says “this is text”. Therefore everything else will be assumed to be a text.

99% of the time that is perfectly fine.

That would be nice but in the end what I get is only the first value.

Ok good idea, let me try that. We’ll see if I only have one value or all of them.

You will have all of them in the list, if you see the list’s count it would be something like 3,4 etc. but if you use it as a text, most probably it will show the first value, unless you handle it as an array and use format as text in order to retreive all the text from all items.

They will be in a list, but what you do with that list depends on what you want to do with list.

You can create a database field of type text as a list and do a “set list”.

You can store them in a single text field using “join with”.

You can run a back end workflow on the list and create a database entry for each one.


Here are some more details to help you understand the problem. I need to write the result of this call in a table. I do it thanks to a recursive worflow.

I defined “capabilities” and “channel_type” as text fields in my table:

This is how they are fed:

The result in the table here below (only the first value of each list):

I tried to format as text before wrting in the table but is not an option because it’s not recognized as a list (despite it’s written as such in the API call).

Still stuck :frowning:

Tried, and not working… :frowning:

Guys, I think I found the problem.

Printing the api call in a repeating group, I have lists:

The problem is from my recursive back end workflow. Both keys are list/array of text and they should be a list of list of text instead…

I have to find a workaround, now it’s clear.

You have 2 options basically:

Change your database fields from text to list of texts, and then save the API reponse directly in it as a list. by using
capabilitity => set list => [capability field from THE API RESPONSE ]

Or you can simply keep your database field as text, and when you are creating a new bridge_bank, do it like:

capabilities = capabilities : formatted as text

Note: Dont do formatted as text on the item # as you are doing in the SS, do it on the main list instead. Like:

capabitiies:item # iteration: formatted as - WRONG
capabilities : formatted as text - CORRECT

Hope that helps.

Yep that’s right, I have to find a way to pass a list of list in my backend workflow and that should do the job.

Many thanks!