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.
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
{"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?
[{"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


















