如何从服务器响应中解析一些数据?
how to parse some data from server response?
我是 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);
})
我是 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);
})