Congratulations on working through it, @reggie! I admire your tenacity. (It’s a problem-solving trait that I share.)
It’s unfortunate that so much time and effort was required to implement something that’s conceptually straightforward - i.e. convert a single object’s properties/values into an array of objects having name/value property pairs.
For the benefit of others who might find themselves in a similar situation, I’d like to offer a couple alternative approaches that might be worth considering, depending on one’s requirements.
Proxy Endpoint
Implement a custom endpoint to call from Bubble. That “intermediary” endpoint would call the “true” endpoint, do the data transformation, and then output an array that Bubble’s API connector would properly recognize as a list.
This could be implemented in code using a service like AWS Lambda functions or Firebase Cloud Functions; or it could be a no-code solution using a service like Integromat or Zapier.
List of Delimited Strings
Create a server-side action, but instead of returning a custom data type, simply return a list of delimited strings that could then be parsed within Bubble using the :split by
operator.
Of course, the string would have to be split whenever a an item’s name or value needed to be accessed, but that’s pretty trivial…
JSON
[
"740300008~~~Accounting",
"740300005~~~Advanced Find / Reporting",
"740300007~~~Automation",
"740300000~~~Classes",
"740300006~~~Committees",
"740300002~~~Core",
"740300003~~~Dues",
"740300001~~~Meetings",
"740300004~~~Membership",
"740300009~~~Other"
]
Editor
Rendered Page
Obviously, it’s not the best developer UX if you’re distributing a plugin, but it could be a viable option for internal and/or infrequent use.
Either approach would avoid having to jump through all the hoops outlined in this thread in order to return a custom data type.
Regards,
-Steve