Forum Academy Marketplace Showcase Pricing Features

Output an object for server-side/client-side

are you doign this for a client side action? i cant figure out how to return the value like is done with the server side action?

No. AFAIK, client-side actions can’t return a value. To make values available client-side, creating an element and publishing one or more Exposed States is the approach I take.


Thanks for the rapid reply! I just tried the same approach and failed. I’ve been returning lists instead of an object. Works for my needs for now. The server side Firebase auth sdk actions are so slow but I don’t know another way to return objects from my outside data calls.

It’ll work for now. Again, thanks for the input!

This is amazing!

Thanks for sharing, and everyone else for making it easier (node module, etc).

My small contribution is that in Step 2 you do not need to add a fake API link. You can just click the Manually Enter API Response button instead.

Screen Shot 2021-02-20 at 3.43.26 pm

This means you can skip parts E, F, G and H of Step 2.

1 Like

Hey guys !

Quick question/update to checker whether things have improved since or not.

Is this still the only available method to return a Key/Value pair object from SSA ?


PS: The keys and values are parameterized, so unfortunately I can’t initialize this object the way in the API connector.
Or alternatively I can pass this object as string and trying to do some magic on the front-end ?

Any suggestion is welcome.


Hey! So to this logic I wouldn’t be able to return deep nested Json? I haven’t tried anything like the complex example of Json you’ve demonstrated with. :clap: my mind explodes at how you worked this out.
For how I like to build in Bubble it’s a game changer.

@jared.gibb from my experimentation you can return deep nested JSON. I’m currently working with JSON several layers deep and Bubble handles it perfectly. A great bonus is that for every new layer / object within the JSON, Bubble allows you to refer to it a as a Type of thing in its own right.

For example, if you had a nesting structure like Transaction > Category > Product where each of those related to an object with fields, when you push the Exposed State to Bubble (if you’re client side) then all three of those objects will be reference-able within Bubble. I.e. you could set a Dropdown Menu to return a Category Thing, and then refer to the fields relating to the selected category elsewhere in workflows etc.

They show up in App Type fields like this :arrow_down:

Screenshot 2021-05-09 at 20.13.25


Sweet! Thanks for sharing to everyone here! I implement this approach for returning data with my plugins and love it!


Sorry for the late reply. As @edwardbutcher said, it is possible to use deep nested JSONs.

I found this feature by accident. I was playing around with the custom API object and the JavascriptToBubble (Toolbox) element. I was so excited when I saw when I sent the custom JSON object, and the Bubble read it!

Regarding deep nested JSONs with arrays:
There is an issue when a template has an array of nested JSON.
For instance, param_1.param_2.param_array. If you send an empty param_array to Bubble, the Bubble will prompt an error, for instance, cannot get the length of undefined/null. As I understand, the Bubble engine parses it and trying to get some info about the array.


BTW, the latest version supports chaging prefix:

So, the default prefix is _p_ - it is for object templates built by all plugins.
The prefix - _api_c2_ is for object templates built by API connectors directly in the app.

1 Like

Do you still have that issue?

I don’t think Bubble is that tolerant of mismatches between the JSON contents and the initialized structure to be able to pass empty objects and arrays.

I ended up passing this object as string.

I wish Bubble would have a key/value return type.


I wish Bubble would add a “Data Tab” to the plugin editor to allow for the definition of custom types. This would make initializing API calls very nice because instead of the kind of hacky “Manually Specify” you could simply pick one of the custom types that were defined.


So one solution would be to call your data API directly inside of the Server Side Actions. For example to create a new record, assuming you pass the home URL in homeurl, and return only the status of the POST:

// Create your thing
var newthing = ...

// Incantation to upload file
var postoptions = {
    uri: properties.homeurl + "api/1.1/obj/mything",
    method: "POST",
    json: newthing

// Send post success status
return context.request(postoptions).body;

Remembering to replace mything in the path with the name of the thing you want to create. The caveat emptor being that your plugin Server Side Action is no longer agnostic to the implementation details of your specific app.