# How to return objects from plugins (SSA, CSA, Element Update & Element Workflow Actions)

**URL:** <https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646>\
**Category:** Plugin builders\
**Created:** [August 21, 2021, 3:55pm UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646 "2021-08-21T15:55:16Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![agoo7714](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/agoo7714/32/129385_2.png) [@agoo7714](https://forum.bubble.io/u/agoo7714)\
**Post date:** [January 28, 2022, 11:07am UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646/22 "2022-01-28T11:07:47Z")

</div>

Hi @lottemint.md I have been using your module and it’s working great. Only issue I’ve found Is I am having trouble getting a response when using arrays of objects.

I am using this simple code to return the data.

```auto
var body = JSON.parse(response.body);

const {convert} = require('json-to-bubble-object');
    
        
let returnlist = []
returnlist.push(convert(body))
                
    return {
        "result": returnlist,
    
    }
}

```

(the response.body is simply the JSON response from the API). For the following response which is a singular objects such as

```auto

{"symbol":"BTCUSDT","priceChange":"181.33000000","priceChangePercent":"0.499","weightedAvgPrice":"36644.71400220","prevClosePrice":"36366.40000000","lastPrice":"36547.73000000","lastQty":"0.08275600","bidPrice":"36546.00000000","bidQty":"0.07223800","askPrice":"36551.16000000","askQty":"0.05581300","openPrice":"36366.40000000","highPrice":"37489.80000000","lowPrice":"35533.92000000","volume":"3393.15320200","quoteVolume":"124341128.65294207","openTime":1643281515271,"closeTime":1643367915271,"firstId":2418729,"lastId":2506758,"count":88030}

```

This code is returning perfectly and I am getting responses as expected. When I run the same code on an array of objects such as the following, I get a null response. Do you know why this is?

```auto
[{"symbol":"BNBBUSD","priceChange":"-170.00000000","priceChangePercent":"-45.946","weightedAvgPrice":"420.48349812","prevClosePrice":"600.00000000","lastPrice":"200.00000000","lastQty":"2.00000000","bidPrice":"0.00000000","bidQty":"0.00000000","askPrice":"350.00000000","askQty":"50.00000000","openPrice":"370.00000000","highPrice":"532.00000000","lowPrice":"200.00000000","volume":"71.81000000","quoteVolume":"30194.92000000","openTime":1643276491573,"closeTime":1643362891573,"firstId":1733,"lastId":1769,"count":37},{"symbol":"BTCBUSD","priceChange":"482142.00000000","priceChangePercent":"93.103","weightedAvgPrice":"613856.95824122","prevClosePrice":"1000000.00000000","lastPrice":"999999.00000000","lastQty":"0.00010000","bidPrice":"250000.00000000","bidQty":"0.00009000","askPrice":"999999.00000000","askQty":"0.00552000","openPrice":"517857.00000000","highPrice":"1000000.00000000","lowPrice":"250000.00000000","volume":"0.03700300","quoteVolume":"22714.54902580","openTime":1643281294370,"closeTime":1643367694370,"firstId":2153,"lastId":2340,"count":188},{"symbol":"ETHBUSD","priceChange":"-45973.11000000","priceChangePercent":"-94.884","weightedAvgPrice":"2984.76894256","prevClosePrice":"25039.43000000","lastPrice":"2479.00000000","lastQty":"0.21779000","bidPrice":"0.00000000","bidQty":"0.00000000","askPrice":"2479.00000000","askQty":"0.15333000","openPrice":"48452.11000000","highPrice":"48452.11000000","lowPrice":"1982.76000000","volume":"4.38794000","quoteVolume":"13096.98703380","openTime":1643278093979,"closeTime":1643364493979,"firstId":7456,"lastId":7550,"count":95},{"symbol":"LTCBUSD","priceChange":"0.00000000","priceChangePercent":"0.000","weightedAvgPrice":"61.00000000","prevClosePrice":"60.00000000","lastPrice":"61.00000000","lastQty":"1.00000000","bidPrice":"0.00000000","bidQty":"0.00000000","askPrice":"0.00000000","askQty":"0.00000000","openPrice":"61.00000000","highPrice":"61.00000000","lowPrice":"61.00000000","volume":"1.00000000","quoteVolume":"61.00000000","openTime":1642790849411,"closeTime":1642877249411,"firstId":279,"lastId":279,"count":1},{"symbol":"TRXBUSD","priceChange":"0.03232000","priceChangePercent":"32.000","weightedAvgPrice":"0.11076213","prevClosePrice":"0.10100000","lastPrice":"0.13332000","lastQty":"1523.50000000","bidPrice":"0.00000000","bidQty":"0.00000000","askPrice":"0.13332000","askQty":"88476.50000000","openPrice":"0.10100000","highPrice":"0.13332000","lowPrice":"0.10100000","volume":"16818.90000000","quoteVolume":"1862.89722000","openTime":1643122833061,"closeTime":1643209233061,"firstId":1249,"lastId":1294,"count":46},{"symbol":"XRPBUSD","priceChange":"-0.01810000","priceChangePercent":"-2.854","weightedAvgPrice":"0.61992932","prevClosePrice":"0.63450000","lastPrice":"0.61610000","lastQty":"1000.50000000","bidPrice":"0.61610000","bidQty":"379.20000000","askPrice":"0.61760000","askQty":"1123.30000000","openPrice":"0.63420000","highPrice":"0.63420000","lowPrice":"0.61020000","volume":"108098.80000000","quoteVolume":"67013.61575000","openTime":1643275083974,"closeTime":1643361483974,"firstId":8697,"lastId":8878,"count":182},{"symbol":"BNBUSDT","priceChange":"15.70000000","priceChangePercent":"4.263","weightedAvgPrice":"378.25471882","prevClosePrice":"368.30000000","lastPrice":"384.00000000","lastQty":"11.24000000","bidPrice":"384.00000000","bidQty":"1.07000000","askPrice":"384.10000000","askQty":"6.70000000","openPrice":"368.30000000","highPrice":"1850.00000000","lowPrice":"74.20000000","volume":"71349.31000000","quoteVolume":"26988213.19210000","openTime":1643281621223,"closeTime":1643368021223,"firstId":343601,"lastId":355850,"count":12250},{"symbol":"BTCUSDT","priceChange":"108.79000000","priceChangePercent":"0.299","weightedAvgPrice":"36644.68429030","prevClosePrice":"36409.39000000","lastPrice":"36518.19000000","lastQty":"0.06572100","bidPrice":"36522.25000000","bidQty":"0.02846000","askPrice":"36524.95000000","askQty":"0.06160200","openPrice":"36409.40000000","highPrice":"37489.80000000","lowPrice":"35533.92000000","volume":"3395.86321500","quoteVolume":"124440335.40672936","openTime":1643281621290,"closeTime":1643368021290,"firstId":2418840,"lastId":2506928,"count":88089},{"symbol":"ETHUSDT","priceChange":"-662.84000000","priceChangePercent":"-30.661","weightedAvgPrice":"1820.66870669","prevClosePrice":"2161.82000000","lastPrice":"1498.98000000","lastQty":"0.06000000","bidPrice":"1476.50000000","bidQty":"0.54404000","askPrice":"1521.46000000","askQty":"2.55087000","openPrice":"2161.82000000","highPrice":"2161.82000000","lowPrice":"1241.43000000","volume":"120.85860000","quoteVolume":"220043.47095490","openTime":1643281618572,"closeTime":1643368018572,"firstId":53006,"lastId":53645,"count":640},{"symbol":"LTCUSDT","priceChange":"0.00000000","priceChangePercent":"0.000","weightedAvgPrice":"438.17565832","prevClosePrice":"461.06000000","lastPrice":"461.06000000","lastQty":"2.48345000","bidPrice":"0.00000000","bidQty":"0.00000000","askPrice":"461.06000000","askQty":"101.80756000","openPrice":"461.06000000","highPrice":"461.06000000","lowPrice":"350.00000000","volume":"10.28616000","quoteVolume":"4507.14492960","openTime":1643265940862,"closeTime":1643352340862,"firstId":2312,"lastId":2331,"count":20},{"symbol":"TRXUSDT","priceChange":"0.00266000","priceChangePercent":"4.890","weightedAvgPrice":"0.06827562","prevClosePrice":"0.05440000","lastPrice":"0.05706000","lastQty":"1752.50000000","bidPrice":"0.00000000","bidQty":"0.00000000","askPrice":"0.05706000","askQty":"356.50000000","openPrice":"0.05440000","highPrice":"0.10000000","lowPrice":"0.05440000","volume":"42086.70000000","quoteVolume":"2873.49573600","openTime":1643260927793,"closeTime":1643347327793,"firstId":2646,"lastId":2709,"count":64},{"symbol":"XRPUSDT","priceChange":"7.13270000","priceChangePercent":"1.858","weightedAvgPrice":"386.25031010","prevClosePrice":"391.04500000","lastPrice":"391.04500000","lastQty":"162.80000000","bidPrice":"0.00000000","bidQty":"0.00000000","askPrice":"391.04500000","askQty":"49663.30000000","openPrice":"383.91230000","highPrice":"391.04500000","lowPrice":"300.00000000","volume":"184.10000000","quoteVolume":"71108.68209000","openTime":1643258286905,"closeTime":1643344686905,"firstId":9343,"lastId":9361,"count":19},{"symbol":"BNBBTC","priceChange":"0.00016900","priceChangePercent":"1.660","weightedAvgPrice":"0.01019432","prevClosePrice":"0.01300000","lastPrice":"0.01035000","lastQty":"0.95000000","bidPrice":"0.01149200","bidQty":"0.20000000","askPrice":"0.00000000","askQty":"0.00000000","openPrice":"0.01018100","highPrice":"0.01039000","lowPrice":"0.01018100","volume":"13.03000000","quoteVolume":"0.13283204","openTime":1643117676485,"closeTime":1643204076485,"firstId":316,"lastId":324,"count":9},{"symbol":"ETHBTC","priceChange":"-0.00374300","priceChangePercent":"-5.464","weightedAvgPrice":"0.06492456","prevClosePrice":"0.08000000","lastPrice":"0.06475700","lastQty":"64.01412000","bidPrice":"0.00000000","bidQty":"0.00000000","askPrice":"0.07780000","askQty":"70.92430000","openPrice":"0.06850000","highPrice":"0.06850000","lowPrice":"0.06475700","volume":"67.01412000","quoteVolume":"4.35086236","openTime":1643276240832,"closeTime":1643362640832,"firstId":3103,"lastId":3104,"count":2},{"symbol":"LTCBTC","priceChange":"0.00000000","priceChangePercent":"0.000","weightedAvgPrice":"0.00000000","prevClosePrice":"0.00319700","lastPrice":"0.00000000","lastQty":"0.00000000","bidPrice":"0.00000000","bidQty":"0.00000000","askPrice":"0.00000000","askQty":"0.00000000","openPrice":"0.00000000","highPrice":"0.00000000","lowPrice":"0.00000000","volume":"0.00000000","quoteVolume":"0.00000000","openTime":1642974551206,"closeTime":1643060951206,"firstId":-1,"lastId":-1,"count":0},{"symbol":"TRXBTC","priceChange":"0.00000000","priceChangePercent":"0.000","weightedAvgPrice":"0.00000222","prevClosePrice":"0.00000165","lastPrice":"0.00000222","lastQty":"6060.00000000","bidPrice":"0.00000168","bidQty":"59.60000000","askPrice":"0.00000000","askQty":"0.00000000","openPrice":"0.00000222","highPrice":"0.00000222","lowPrice":"0.00000222","volume":"6060.00000000","quoteVolume":"0.01345320","openTime":1643121796546,"closeTime":1643208196546,"firstId":5,"lastId":5,"count":1},{"symbol":"XRPBTC","priceChange":"0.00000000","priceChangePercent":"0.000","weightedAvgPrice":"0.00001650","prevClosePrice":"0.00001650","lastPrice":"0.00001650","lastQty":"11.00000000","bidPrice":"0.00000000","bidQty":"0.00000000","askPrice":"0.00001650","askQty":"12489.00000000","openPrice":"0.00001650","highPrice":"0.00001650","lowPrice":"0.00001650","volume":"11.00000000","quoteVolume":"0.00018150","openTime":1643194419610,"closeTime":1643280819610,"firstId":1536,"lastId":1536,"count":1},{"symbol":"LTCBNB","priceChange":"0.00000000","priceChangePercent":"0.000","weightedAvgPrice":"0.00000000","prevClosePrice":"0.17450000","lastPrice":"0.00000000","lastQty":"0.00000000","bidPrice":"0.00000000","bidQty":"0.00000000","askPrice":"0.00000000","askQty":"0.00000000","openPrice":"0.00000000","highPrice":"0.00000000","lowPrice":"0.00000000","volume":"0.00000000","quoteVolume":"0.00000000","openTime":1642847149592,"closeTime":1642933549592,"firstId":-1,"lastId":-1,"count":0},{"symbol":"TRXBNB","priceChange":"0.00000030","priceChangePercent":"0.200","weightedAvgPrice":"0.00014987","prevClosePrice":"0.00000000","lastPrice":"0.00015000","lastQty":"1000.00000000","bidPrice":"0.00000000","bidQty":"0.00000000","askPrice":"0.00000000","askQty":"0.00000000","openPrice":"0.00014970","highPrice":"0.00015010","lowPrice":"0.00014970","volume":"4000.00000000","quoteVolume":"0.59950000","openTime":1641243788364,"closeTime":1641330188364,"firstId":0,"lastId":3,"count":4},{"symbol":"XRPBNB","priceChange":"0.00000000","priceChangePercent":"0.000","weightedAvgPrice":"0.00162700","prevClosePrice":"0.00162700","lastPrice":"0.00162700","lastQty":"90000.00000000","bidPrice":"0.00000000","bidQty":"0.00000000","askPrice":"0.00000000","askQty":"0.00000000","openPrice":"0.00162700","highPrice":"0.00162700","lowPrice":"0.00162700","volume":"90000.00000000","quoteVolume":"146.43000000","openTime":1642126497120,"closeTime":1642212897120,"firstId":8,"lastId":906,"count":899}]

```

SORRY about the giant objects, but just wanted to use the real data I am using. The main point is that the first body is a singular objects, and the second is an array of objects.

Thanks

---

<div class="post-metadata">

**Author:** ![agoo7714](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/agoo7714/32/129385_2.png) [@agoo7714](https://forum.bubble.io/u/agoo7714)\
**Post date:** [February 4, 2022, 10:26pm UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646/23 "2022-02-04T22:26:02Z")

</div>

@jared.gibb Would you be able to shed some light on how to return arrays of objects? I’m struggling with this on a variety of API calls similar to this above comment.

---

<div class="post-metadata">

**Author:** ![jared.gibb](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jared.gibb/32/123329_2.png) [@jared.gibb](https://forum.bubble.io/u/jared.gibb)\
**Post date:** [February 4, 2022, 10:43pm UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646/24 "2022-02-04T22:43:26Z")

</div>

Did you see the very first video in this thread? 🤪

Where do you get lost? Wanna share a code example?

---

<div class="post-metadata">

**Author:** ![agoo7714](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/agoo7714/32/129385_2.png) [@agoo7714](https://forum.bubble.io/u/agoo7714)\
**Post date:** [February 4, 2022, 11:13pm UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646/25 "2022-02-04T23:13:46Z")

</div>

Hi @jared.gibb , yes the first video was extremely helpful and I’, successfully returning objects from my plugin calls. My issue is when I have an array of objects rather than a singular object to return.

My action code is the following:

```auto
function(properties, context) {
  
    var burl = ''
    , query = ''
    , method = 'GET'
    , testa = '';
    
 
    const ts = Date.now();

var crypto = require('crypto-js')
    

                  , text = 'timestamp=' + Date.now()
                  , skey = properties.secret_key
                  , hash
					, symbolinput = properties.symbol.trim()
					, symbola = ''					
					, symbol = '';
    
    if (properties.testnet.toString() == "false")
    	burl = 'https://api.binance.com/api/v3/';
    else
        burl = 'https://testnet.binance.vision/api/v3/';
   

if (symbolinput.length > 0){
		symbola = symbolinput.toUpperCase();
    	symbol = "?symbol=" + symbola.replace(/\s+/g, ' ').trim()
}
    
if (properties.endpoint.trim() == "Current Average Price"){
    var query = 'avgPrice' + symbol;
}

if (properties.endpoint.trim() == "24hr Ticker Price Change Statistics"){
    var query = 'ticker/24hr' + symbol;
}
    				
var hash = crypto.HmacSHA256(text, skey).toString()
	, url = burl + query

const options = {
    url: url
    ,method: method
    ,headers: {
        "Content-Type": "application/json"
    }
}

const response = context.request(options);
	console.log(response);
    

var body = JSON.parse(response.body);

const {convert} = require('json-to-bubble-object');
        
let returnlist = []
returnlist.push(convert(body))
                
    return {
        "result": returnlist,
        "api_result": JSON.stringify(body)
    
    }
}

```

When I specify a Symbol, the result is returned as the following

```auto

Demo Login
{"symbol":"BTCUSDT","priceChange":"3682.66000000","priceChangePercent":"9.959","weightedAvgPrice":"38562.22336739","prevClosePrice":"36978.77000000","lastPrice":"40661.51000000","lastQty":"0.00491600","bidPrice":"40661.53000000","bidQty":"0.05017100","askPrice":"40661.54000000","askQty":"0.05951600","openPrice":"36978.85000000","highPrice":"60000.00000000","lowPrice":"7500.00000000","volume":"3571.14095500","quoteVolume":"137711135.18314058","openTime":1643929763213,"closeTime":1644016163213,"firstId":332519,"lastId":475709,"count":143191}

```

and the object is returned and displayed in my RG

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/a/2/a21fd2becd709f8cbb300e96d2c230ebd6e3d1a7.png)

But when I don’t specify a Symbol (which returns all symbols data), the response is an ARRAY of objects like as follows, and all the fields are displayed as null.

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/1/9/19439d4ef4e2617264a302bef38454c38e22edd0.png)

```auto

Demo Login
[{"symbol":"BNBBUSD","priceChange":"-260.30000000","priceChangePercent":"-72.245","weightedAvgPrice":"261.29676153","prevClosePrice":"380.00000000","lastPrice":"100.00000000","lastQty":"0.10000000","bidPrice":"0.00000000","bidQty":"0.00000000","askPrice":"400.00000000","askQty":"16.61000000","openPrice":"360.30000000","highPrice":"400.00000000","lowPrice":"100.00000000","volume":"101.90000000","quoteVolume":"26626.14000000","openTime":1643928538140,"closeTime":1644014938140,"firstId":167,"lastId":229,"count":63},{"symbol":"BTCBUSD","priceChange":"-397015.20000000","priceChangePercent":"-96.928","weightedAvgPrice":"199767.05017855","prevClosePrice":"15731.00000000","lastPrice":"12584.80000000","lastQty":"0.01770000","bidPrice":"12584.80000000","bidQty":"0.00794600","askPrice":"800000.00000000","askQty":"0.00312900","openPrice":"409600.00000000","highPrice":"1000000.00000000","lowPrice":"12584.80000000","volume":"0.10249400","quoteVolume":"20474.92404100","openTime":1643929869031,"closeTime":1644016269031,"firstId":984,"lastId":1112,"count":129},{"symbol":"ETHBUSD","priceChange":"317.96000000","priceChangePercent":"12.166","weightedAvgPrice":"2682.22056263","prevClosePrice":"2715.36000000","lastPrice":"2931.38000000","lastQty":"0.03411000","bidPrice":"2612.40000000","bidQty":"0.23518000","askPrice":"2931.38000000","askQty":"0.03483000","openPrice":"2613.42000000","highPrice":"2931.38000000","lowPrice":"2612.40000000","volume":"11.89729000","quoteVolume":"31911.15587760","openTime":1643929208027,"closeTime":1644015608027,"firstId":1201,"lastId":1271,"count":71},{"symbol":"LTCBUSD","priceChange":"-10.40000000","priceChangePercent":"-9.420","weightedAvgPrice":"109.56956955","prevClosePrice":"110.00000000","lastPrice":"100.00000000","lastQty":"0.18116000","bidPrice":"100.00000000","bidQty":"4.81884000","askPrice":"110.40000000","askQty":"7.91238000","openPrice":"110.40000000","highPrice":"110.40000000","lowPrice":"100.00000000","volume":"2.26878000","quoteVolume":"248.58924800","openTime":1643927358794,"closeTime":1644013758794,"firstId":6,"lastId":13,"count":8},{"symbol":"TRXBUSD","priceChange":"0.00000000","priceChangePercent":"0.000","weightedAvgPrice":"0.00000000","prevClosePrice":"0.06018000","lastPrice":"0.00000000","lastQty":"0.00000000","bidPrice":"0.05955000","bidQty":"1000.00000000","askPrice":"0.00000000","askQty":"0.00000000","openPrice":"0.00000000","highPrice":"0.00000000","lowPrice":"0.00000000","volume":"0.00000000","quoteVolume":"0.00000000","openTime":1643846868283,"closeTime":1643933268283,"firstId":-1,"lastId":-1,"count":0},{"symbol":"XRPBUSD","priceChange":"-0.01760000","priceChangePercent":"-2.940","weightedAvgPrice":"0.60186777","prevClosePrice":"0.59880000","lastPrice":"0.58100000","lastQty":"172.10000000","bidPrice":"0.57500000","bidQty":"1652.20000000","askPrice":"0.59310000","askQty":"172.10000000","openPrice":"0.59860000","highPrice":"0.61060000","lowPrice":"0.56100000","volume":"108426.80000000","quoteVolume":"65258.59666000","openTime":1643928550344,"closeTime":1644014950344,"firstId":605,"lastId":782,"count":178},{"symbol":"BNBUSDT","priceChange":"26.80000000","priceChangePercent":"7.251","weightedAvgPrice":"380.08239973","prevClosePrice":"369.50000000","lastPrice":"396.40000000","lastQty":"6.35000000","bidPrice":"396.40000000","bidQty":"2.28000000","askPrice":"396.50000000","askQty":"6.92000000","openPrice":"369.60000000","highPrice":"398.20000000","lowPrice":"80.00000000","volume":"41526.98000000","quoteVolume":"15783674.21180000","openTime":1643929863662,"closeTime":1644016263662,"firstId":70606,"lastId":78117,"count":7512},{"symbol":"BTCUSDT","priceChange":"3647.90000000","priceChangePercent":"9.859","weightedAvgPrice":"38564.23034247","prevClosePrice":"37000.16000000","lastPrice":"40647.14000000","lastQty":"0.00250000","bidPrice":"40647.13000000","bidQty":"0.07019500","askPrice":"40647.14000000","askQty":"0.06589400","openPrice":"36999.24000000","highPrice":"60000.00000000","lowPrice":"7500.00000000","volume":"3568.59494800","quoteVolume":"137620117.57363274","openTime":1643929870517,"closeTime":1644016270517,"firstId":332606,"lastId":475743,"count":143138},{"symbol":"ETHUSDT","priceChange":"-79.19000000","priceChangePercent":"-7.999","weightedAvgPrice":"946.20699162","prevClosePrice":"992.02000000","lastPrice":"910.85000000","lastQty":"0.01207000","bidPrice":"909.03000000","bidQty":"0.13365000","askPrice":"912.67000000","askQty":"18.62675000","openPrice":"990.04000000","highPrice":"2373.20000000","lowPrice":"463.14000000","volume":"581.75887000","quoteVolume":"550464.31023250","openTime":1643929804202,"closeTime":1644016204202,"firstId":1614,"lastId":2846,"count":1233},{"symbol":"LTCUSDT","priceChange":"-10.50000000","priceChangePercent":"-9.013","weightedAvgPrice":"110.36943858","prevClosePrice":"116.50000000","lastPrice":"106.00000000","lastQty":"281.14085000","bidPrice":"0.00000000","bidQty":"0.00000000","askPrice":"106.00000000","askQty":"218.85915000","openPrice":"116.50000000","highPrice":"116.50000000","lowPrice":"106.00000000","volume":"481.51853000","quoteVolume":"53144.92982000","openTime":1643929803923,"closeTime":1644016203923,"firstId":170,"lastId":273,"count":104},{"symbol":"TRXUSDT","priceChange":"-0.03676000","priceChangePercent":"-36.760","weightedAvgPrice":"0.07982987","prevClosePrice":"0.10000000","lastPrice":"0.06324000","lastQty":"1903.00000000","bidPrice":"0.06355000","bidQty":"1888.00000000","askPrice":"0.00000000","askQty":"0.00000000","openPrice":"0.10000000","highPrice":"1.49575000","lowPrice":"0.05800000","volume":"44517.00000000","quoteVolume":"3553.78628000","openTime":1643884562781,"closeTime":1643970962781,"firstId":144,"lastId":210,"count":67},{"symbol":"XRPUSDT","priceChange":"-0.10000000","priceChangePercent":"-16.667","weightedAvgPrice":"0.61590748","prevClosePrice":"0.60000000","lastPrice":"0.50000000","lastQty":"300.00000000","bidPrice":"0.50000000","bidQty":"183.20000000","askPrice":"0.00000000","askQty":"0.00000000","openPrice":"0.60000000","highPrice":"3.08800000","lowPrice":"0.50000000","volume":"13689.80000000","quoteVolume":"8431.65024000","openTime":1643926264152,"closeTime":1644012664152,"firstId":332,"lastId":476,"count":145},{"symbol":"BNBBTC","priceChange":"0.00000000","priceChangePercent":"0.000","weightedAvgPrice":"0.00991409","prevClosePrice":"0.00993100","lastPrice":"0.00993100","lastQty":"0.31000000","bidPrice":"0.00893100","bidQty":"0.10000000","askPrice":"0.00993100","askQty":"672.80000000","openPrice":"0.00993100","highPrice":"0.00993100","lowPrice":"0.00731000","volume":"103.63000000","quoteVolume":"1.02739693","openTime":1643927113274,"closeTime":1644013513274,"firstId":206,"lastId":231,"count":26},{"symbol":"ETHBTC","priceChange":"0.22787000","priceChangePercent":"315.916","weightedAvgPrice":"0.24303250","prevClosePrice":"0.07214500","lastPrice":"0.30000000","lastQty":"3.00000000","bidPrice":"0.00000000","bidQty":"0.00000000","askPrice":"0.30000000","askQty":"9.00000000","openPrice":"0.07213000","highPrice":"0.30000000","lowPrice":"0.07213000","volume":"4.00000000","quoteVolume":"0.97213000","openTime":1643884608187,"closeTime":1643971008187,"firstId":8,"lastId":9,"count":2},{"symbol":"LTCBTC","priceChange":"0.00000000","priceChangePercent":"0.000","weightedAvgPrice":"0.00000000","prevClosePrice":"0.00287400","lastPrice":"0.00000000","lastQty":"0.00000000","bidPrice":"0.00297700","bidQty":"1.00000000","askPrice":"0.00000000","askQty":"0.00000000","openPrice":"0.00000000","highPrice":"0.00000000","lowPrice":"0.00000000","volume":"0.00000000","quoteVolume":"0.00000000","openTime":1643883202421,"closeTime":1643969602421,"firstId":-1,"lastId":-1,"count":0},{"symbol":"TRXBTC","priceChange":"0.00000000","priceChangePercent":"0.000","weightedAvgPrice":"0.00000156","prevClosePrice":"0.00000156","lastPrice":"0.00000156","lastQty":"512.80000000","bidPrice":"0.00000000","bidQty":"0.00000000","askPrice":"0.00000156","askQty":"344.70000000","openPrice":"0.00000156","highPrice":"0.00000156","lowPrice":"0.00000156","volume":"512.80000000","quoteVolume":"0.00079996","openTime":1643873130126,"closeTime":1643959530126,"firstId":6,"lastId":9,"count":4},{"symbol":"XRPBTC","priceChange":"0.00000000","priceChangePercent":"0.000","weightedAvgPrice":"0.00001627","prevClosePrice":"0.00001627","lastPrice":"0.00001627","lastQty":"158.60000000","bidPrice":"0.00000000","bidQty":"0.00000000","askPrice":"0.00001627","askQty":"65.60000000","openPrice":"0.00001627","highPrice":"0.00001627","lowPrice":"0.00001627","volume":"158.60000000","quoteVolume":"0.00258040","openTime":1643873454115,"closeTime":1643959854115,"firstId":10,"lastId":15,"count":6},{"symbol":"LTCBNB","priceChange":"0.00000000","priceChangePercent":"0.000","weightedAvgPrice":"0.30569997","prevClosePrice":"0.29970000","lastPrice":"0.30570000","lastQty":"0.25967000","bidPrice":"0.00000000","bidQty":"0.00000000","askPrice":"0.00000000","askQty":"0.00000000","openPrice":"0.30570000","highPrice":"0.30570000","lowPrice":"0.30570000","volume":"0.25967000","quoteVolume":"0.07938111","openTime":1643865673352,"closeTime":1643952073352,"firstId":6,"lastId":6,"count":1},{"symbol":"TRXBNB","priceChange":"0.00000000","priceChangePercent":"0.000","weightedAvgPrice":"0.00000000","prevClosePrice":"0.00015750","lastPrice":"0.00000000","lastQty":"0.00000000","bidPrice":"0.00016130","bidQty":"98574.20000000","askPrice":"0.00016150","askQty":"94117.70000000","openPrice":"0.00000000","highPrice":"0.00000000","lowPrice":"0.00000000","volume":"0.00000000","quoteVolume":"0.00000000","openTime":1643924658455,"closeTime":1644011058455,"firstId":-1,"lastId":-1,"count":0},{"symbol":"XRPBNB","priceChange":"0.00000000","priceChangePercent":"0.000","weightedAvgPrice":"0.00163800","prevClosePrice":"0.00162800","lastPrice":"0.00163800","lastQty":"1000.00000000","bidPrice":"0.00000000","bidQty":"0.00000000","askPrice":"0.00000000","askQty":"0.00000000","openPrice":"0.00163800","highPrice":"0.00163800","lowPrice":"0.00163800","volume":"1000.00000000","quoteVolume":"1.63800000","openTime":1643691995629,"closeTime":1643778395629,"firstId":3,"lastId":3,"count":1}]

```

The key thing to note is the difference, which I think is causing my problems. I am receiving the api result, but for some reason the returnlist function is not returning the result. I feel I am doing something obviously wrong but I’m having trouble figuring it out. I think It may be because bubble thinks I’m returning an array rather than an object

---

<div class="post-metadata">

**Author:** ![jared.gibb](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jared.gibb/32/123329_2.png) [@jared.gibb](https://forum.bubble.io/u/jared.gibb)\
**Post date:** [February 4, 2022, 11:34pm UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646/26 "2022-02-04T23:34:13Z")

</div>

How did you define your return value?

How did you define your custom data type I. The api connector?

Idk how that library works to bubblize JSON bodies. I’d recommend doing this step yourself.

What does the response from the api look like when you request 1 vs all tokens?

---

<div class="post-metadata">

**Author:** ![agoo7714](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/agoo7714/32/129385_2.png) [@agoo7714](https://forum.bubble.io/u/agoo7714)\
**Post date:** [February 5, 2022, 6:26am UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646/27 "2022-02-05T06:26:29Z")

</div>

@jared.gibb Thanks for your help. I have solved the problem. For anyone else with issues of returning Arrays of objects, my solution is the following code"

```auto

const response = context.request(options);
	console.log(response);
    

var body = JSON.parse(response.body);

const {convert} = require('json-to-bubble-object');
        
let returnlist = []

if (Array.isArray(body) == false){
returnlist.push(convert(body))
}
    else {
        for (let i = 0; i < body.length; i++) {
  returnlist[i] = convert(body[i]);
}
    }
        
                
    return {
        "result": returnlist,    
    }
}

```

Essentially, if the returned API data is just one single object, without [], we can pass that through as per the usual. If not, Iterate through each object in the array and use the convert function to include the _p_ prefix to each object. This then allows it to be passed back through the API as a list.

---

<div class="post-metadata">

**Author:** ![SJL](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/sjl/32/93757_2.png) [@SJL](https://forum.bubble.io/u/SJL)\
**Post date:** [February 20, 2022, 8:10am UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646/28 "2022-02-20T08:10:34Z")

</div>

Would love some help returning a value client side from an action - so far this seems impossible!

---

<div class="post-metadata">

**Author:** ![jared.gibb](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jared.gibb/32/123329_2.png) [@jared.gibb](https://forum.bubble.io/u/jared.gibb)\
**Post date:** [February 20, 2022, 1:02pm UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646/29 "2022-02-20T13:02:44Z")

</div>

Did you see the video above? Which part didn’t work for you?

---

<div class="post-metadata">

**Author:** ![SJL](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/sjl/32/93757_2.png) [@SJL](https://forum.bubble.io/u/SJL)\
**Post date:** [February 20, 2022, 8:46pm UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646/30 "2022-02-20T20:46:28Z")

</div>

Hi @jared.gibb ,

Mostly the part where there was no video 😉

 ![Screenshot_2022-02-21-07-44-29-912_com.android.chrome](https://us1.discourse-cdn.com/bubble/original/3X/a/d/ad7bfb18d14ba4ede9f93564eb98eb1444b49bdf.png)

Although on further reading, I don’t believe it’s possible with Client Side actions

Cheers  
Simon

---

<div class="post-metadata">

**Author:** ![sharifa](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@sharifa](https://forum.bubble.io/u/sharifa)\
**Post date:** [March 17, 2022, 9:26pm UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646/31 "2022-03-17T21:26:03Z")

</div>

@jared.gibb Hey Jared, First, thank you for taking the time to thoroughly outline and explain these steps! This is enormously helpful. I have a followup question for you or anybody that can answer. Perhaps you will cover this in video 2, but I’m not sure, so I’ll go head and ask here.

How do you pass dynamic url parameters from the API call tab to the elements tab for use in the code on the elements and/or actions tab?

Essentially, I want to use/transform a dynamic variable(s) provided from the “get data from API” feature, before returning the response as JSON.

Adding the parameter is easy, I’m just perplexed about how to call it and assign it as a variable in the actual code. Maybe it’s obvious, but I haven’t seen any documentation on how to explicitly do this.

---

<div class="post-metadata">

**Author:** ![d9999](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/d9999/32/95645_2.png) [@d9999](https://forum.bubble.io/u/d9999)\
**Post date:** [April 12, 2022, 7:31pm UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646/32 "2022-04-12T19:31:38Z")

</div>

awesome, thanks!

---

<div class="post-metadata">

**Author:** ![seghirtewfiq](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@seghirtewfiq](https://forum.bubble.io/u/seghirtewfiq)\
**Post date:** [September 2, 2022, 1:32pm UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646/33 "2022-09-02T13:32:27Z")

</div>

Hello Everybody,

First of all, thank you very much @jared.gibb for this full tutorial, it’s help me a lot, and I think I (finally) understand some basics. It’s real game changer for bubble building.

Second, English is not my native language, so I’m sorry if some things are not clear. Plus i’m not a “coder” and I have just very few knowledges about JS et nodejs.

Third, PLEEEEAAASE I need your help. I’m struggle with this for weeks, so there it is :

I’m trying to create a plugin for calculate Levenshtein Distance.  
If you don’t know what it is, it’s the difference between to strings (e.g : love/love = 0 because it’s the same word, love/hate = 3 because 3 letters has been changed… )

for that I use the [nodejs package levenshtein](https://npm.runkit.com/levenshtein).

I need to catch the result (levenshtein.distance) and change a cell’s data of my bubble DB.  
I use server side action, because I need to loop the worklow.

Here is how I process :

1 - The user click on the button, the first action launch the API Workflow.

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/5/c/5c212753f0f47254d8dcd1dbe714d7fbd76b55dc.png)

2 - Here is the API Worklow launched. First step, is ok then, I launch my plugin SCORE

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/4/0/40b7128fc32d0c2d69de9edd46e4f26c3d318599.png)

3 - I want to keep the result on the database in a user field in the next step

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/b/9/b95565bd29eb568718397b8a3345f6b8344a6dbf.png)

That where it’s not working.

So plugin side :

1 - Plugin API Calls

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/6/b/6b3413985f5c11f605cde406e8213958e438b942.png)

2 - API Response

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/b/a/ba748e31d1961a69fd3b66872959f6ea2bafcf4d.png)  
 ![image](https://us1.discourse-cdn.com/bubble/original/3X/5/f/5ffc1e14c2b801f5bdae0f30e601b6baccccc9a0.png)

3 - Values

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/c/a/ca9ded3046859799a6767bc8537b0f34586cd6b7.png)

4 - Code

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/8/2/8266d2d79d69413be8323ca0a1f5930d0f1c1e2f.png)

5 - SSA Console Output

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/0/b/0bcfffb1aec2b91d9bcaa65d1b5c90343369280f.png)

If I change the console.log(score) to return {“score\_titre” : score}, nothing happend… I don’t get it.  
I don’t know what I missing or if use it the wrong way ?

Thank you very much for reading me and your help!!

Tewfiq

---

<div class="post-metadata">

**Author:** ![jared.gibb](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jared.gibb/32/123329_2.png) [@jared.gibb](https://forum.bubble.io/u/jared.gibb)\
**Post date:** [September 2, 2022, 10:37pm UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646/34 "2022-09-02T22:37:15Z")

</div>

You never `return {“some”:”value”}`

You probably want to

```
return {
“_p_score_titre”: levscore.distance
}

```

But you probably have an async action happening there and you’ll need more code than that if true

---

<div class="post-metadata">

**Author:** ![seghirtewfiq](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@seghirtewfiq](https://forum.bubble.io/u/seghirtewfiq)\
**Post date:** [September 3, 2022, 3:12pm UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646/35 "2022-09-03T15:12:07Z")

</div>

Thank for your answer.  
Actually, I try both way and the both return nothing.

But… just with this

```
function(properties, context) {
		var levenshtein = require("levenshtein")
		var srt1 = properties.reponsetitre
		var srt2 = properties.sessiontitre
		var levscore = new levenshtein(srt1,srt2)
    
		var score = levscore.distance
        
return {"score_titre": score};
    
}

```

I have the response.  
I don’t understand why, but it’s working

---

<div class="post-metadata">

**Author:** ![bubble.trouble](https://avatars.discourse-cdn.com/v4/letter/b/7ba0ec/32.png) [@bubble.trouble](https://forum.bubble.io/u/bubble.trouble)\
**Post date:** [September 3, 2022, 3:17pm UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646/36 "2022-09-03T15:17:40Z")

</div>

The reason it works is because score\_titre is the name of the return field that you defined in your returned values above. It appears that levscore.distance is simply a number. You don’t need to define the API type to return a simple type like a number.

Maybe your end goal/hope is to return more than just the distance value. But as your code is currently I think you have slightly overcomplicated the concept.

---

<div class="post-metadata">

**Author:** ![jared.gibb](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jared.gibb/32/123329_2.png) [@jared.gibb](https://forum.bubble.io/u/jared.gibb)\
**Post date:** [September 3, 2022, 3:41pm UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646/37 "2022-09-03T15:41:30Z")

</div>

do a search for a plugin called “Return a bubble thing”

see it in action here

> **[Bubble Editor - Jaredgibb](https://bubble.io/page?type=page&name=return_object_demo&id=jaredgibb&tab=tabs-1)**
>
> Build stuff without code and launch a startup without a tech-cofounder! Bubble is a visual programing language. Instead of typing code, use a visual editor to build applications.

its a demo i made. be sure to check out the code. this is what you are shooting for.

---

<div class="post-metadata">

**Author:** ![seghirtewfiq](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@seghirtewfiq](https://forum.bubble.io/u/seghirtewfiq)\
**Post date:** [September 3, 2022, 3:52pm UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646/38 "2022-09-03T15:52:37Z")

</div>

Thank you, it’s more clear now!

And yes, I have overcomplicated the concept!! But, reassure me, it’s newbies mistakes no ??

---

<div class="post-metadata">

**Author:** ![seghirtewfiq](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@seghirtewfiq](https://forum.bubble.io/u/seghirtewfiq)\
**Post date:** [September 3, 2022, 3:53pm UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646/39 "2022-09-03T15:53:22Z")

</div>

Thank you so much for your work !!

---

<div class="post-metadata">

**Author:** ![rico.trevisan](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rico.trevisan/32/170176_2.png) [@rico.trevisan](https://forum.bubble.io/u/rico.trevisan)\
**Post date:** [September 24, 2022, 7:18am UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646/40 "2022-09-24T07:18:34Z")

</div>

Excellent tutorials, @jared.gibb . I love the name of the test app `poop123`. I’m here for that.

---

<div class="post-metadata">

**Author:** ![jasantana](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jasantana/32/132275_2.png) [@jasantana](https://forum.bubble.io/u/jasantana)\
**Post date:** [October 17, 2022, 6:43am UTC](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646/41 "2022-10-17T06:43:56Z")

</div>

Thanks for sharing this tutorial !!  
I’m struggling to make it work I get an error when parsing the response.

 ![Screenshot 2022-10-17 at 07.38.41](https://us1.discourse-cdn.com/bubble/original/3X/2/2/229a278636bdb551b40edb1865087da39cab65eb.png)

Can anyone help me here? I must be missing something but I cannot find it

This is my setup:

 ![Screenshot 2022-10-17 at 07.37.28](https://us1.discourse-cdn.com/bubble/original/3X/3/e/3e5e80eed9a8d5b0cef78f11cb72fb99e36d1f7b.png)

 ![Screenshot 2022-10-17 at 07.36.02](https://us1.discourse-cdn.com/bubble/original/3X/3/4/34de0abd018ba103a0ebbac385f89ce42788246c.png)

 ![Screenshot 2022-10-17 at 07.36.27](https://us1.discourse-cdn.com/bubble/original/3X/f/1/f1db33e9cc43c411acedbb74f48f730a092ed50a.png)

 ![Screenshot 2022-10-17 at 07.36.48](https://us1.discourse-cdn.com/bubble/original/3X/b/a/ba5a4d5975e124d886e9d077e32a119d785e8581.png)

 ![Screenshot 2022-10-17 at 07.37.08](https://us1.discourse-cdn.com/bubble/original/3X/0/6/0662a638742dc4fc861d4377f49b6339679f8545.png)

[Previous page](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646.md?page=1)

[Next page](https://forum.bubble.io/t/how-to-return-objects-from-plugins-ssa-csa-element-update-element-workflow-actions/165646.md?page=3)
