Hey Bubble community,
I’m working with an API in Bubble’s API Connector, and I’m running into an issue where the API response sometimes returns a list of items and other times returns a single object instead of a list. This is causing problems with saving the data .
Thanks in advance!
This is a common issue when APIs return inconsistent responses. To handle it in Bubble, you can try the following:
- Force the API to always return a list: If you have control over the API, adjust the response so it always returns an array, even if there is only one item.
- Use the “Format as List” action: In Bubble, you can wrap the response in “Format as List” to ensure both cases are treated as a list.
- Manipulate it with JavaScript: If the issue persists, you could use a small JavaScript script within Bubble to check if the response is an object and convert it into an array.
If you need a more specific solution, let me know which API you’re using and how you’ve set up the call in the API Connector.