如何从服务器响应中解析一些数据?



我是nodejs的新手。我现在有这样的代码。

var Coinpayments = require('coinpayments');
var cpayment = new Coinpayments({
key: 'api',
secret: 'api',
autoIpn: true
});
var address = cpayment.getCallbackAddress("BTC", function (err, response) {
console.log(response);
})

它回答了波纹管响应:

{ address: '3Du1WGxRf1bPZXrX1EyhdAYB4g113RnDeY' }

但我需要这样的答案:

'3Du1WGxRf1bPZXrX1EyhdAYB4g113RnDeY'

谁能帮我?

您需要像这样访问地址键的值:

var Coinpayments = require('coinpayments');
var cpayment = new Coinpayments({
key: 'api',
secret: 'api',
autoIpn: true
});
var address = cpayment.getCallbackAddress("BTC", function (err, response) {
console.log(response.address);
})

相关内容

  • 没有找到相关文章

最新更新