node.js - axios gives me converting circular structure to json error while sending the data -
my code shown below:
axios.post('https://api.sandbox.xyz.com/v1/order/new', json.stringify({ "request": "/v1/order/new", "nonce": 123462, "client_order_id": "20150102-4738721", "symbol": "btcusd", "amount": "1.01", "price": "11.13", "side": "buy", "type": "exchange limit" }), config) .then(function(response) { console.log(response); res.json({ data: json.stringify(response) }) }) .catch(function(error) { console.log(error); res.send({ status: '500', message: error }) }); now saying unhandled promise rejection (rejection id: 2): typeerror: converting circular structure json code res.json({data:json.stringify(response)})
so, there missing in code ?
axios.post('https://api.sandbox.xyz.com/v1/order/new', json.stringify({ "request": "/v1/order/new", "nonce": 123462, "client_order_id": "20150102-4738721", "symbol": "btcusd", "amount": "1.01", "price": "11.13", "side": "buy", "type": "exchange limit" }), config) .then(function(response) { res.send(response.data) }) .catch(function(error) { res.send({ status: '500', message: error }) });
Comments
Post a Comment