how to parse some data from json response? [duplicate]
This question already has an answer here:
From an array of objects, extract value of a property as array
13 answers
Access / process (nested) objects, arrays or JSON
20 answers
I'm new to nodejs. I now have a code like this.
client.listSinceBlock(hash, function(err, info) {
if (err) {
console.error('Unable to get block info for: ', hash, ' got error: ', err);
return callback(err);
}
var transactionsIds = info;
console.log('txids ', transactionsIds);
});
which answers the bellow response :
{ transactions:
[ { account: '',
txid: '925cb1434f64567539896ee370b8dfca7c46d5c0a7482f2ce85d8a9fea976411',
abandoned: false },
{ account: '',
txid: 'afda7a1d90310c8fea22dff809062c72754e58e1a1918a55e210c59ad8a9b11c',
'bip125-replaceable': 'no' },
{ account: '',
txid: '30053a0b819f03bc37626468ce27b718140ce2db6c054c84899c7db0cb62fa26',
'bip125-replaceable': 'no',
abandoned: false },
],
removed: ,
lastblock: 'some data' }
But i need parse TXIDs from this response like below :
{
"tx": [
"925cb1434f64567539896ee370b8dfca7c46d5c0a7482f2ce85d8a9fea976411",
"afda7a1d90310c8fea22dff809062c72754e58e1a1918a55e210c59ad8a9b11c",
"30053a0b819f03bc37626468ce27b718140ce2db6c054c84899c7db0cb62fa26"
],
}
Can anyone help me?
javascript node.js
marked as duplicate by Felix Kling
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 2 at 20:21
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
From an array of objects, extract value of a property as array
13 answers
Access / process (nested) objects, arrays or JSON
20 answers
I'm new to nodejs. I now have a code like this.
client.listSinceBlock(hash, function(err, info) {
if (err) {
console.error('Unable to get block info for: ', hash, ' got error: ', err);
return callback(err);
}
var transactionsIds = info;
console.log('txids ', transactionsIds);
});
which answers the bellow response :
{ transactions:
[ { account: '',
txid: '925cb1434f64567539896ee370b8dfca7c46d5c0a7482f2ce85d8a9fea976411',
abandoned: false },
{ account: '',
txid: 'afda7a1d90310c8fea22dff809062c72754e58e1a1918a55e210c59ad8a9b11c',
'bip125-replaceable': 'no' },
{ account: '',
txid: '30053a0b819f03bc37626468ce27b718140ce2db6c054c84899c7db0cb62fa26',
'bip125-replaceable': 'no',
abandoned: false },
],
removed: ,
lastblock: 'some data' }
But i need parse TXIDs from this response like below :
{
"tx": [
"925cb1434f64567539896ee370b8dfca7c46d5c0a7482f2ce85d8a9fea976411",
"afda7a1d90310c8fea22dff809062c72754e58e1a1918a55e210c59ad8a9b11c",
"30053a0b819f03bc37626468ce27b718140ce2db6c054c84899c7db0cb62fa26"
],
}
Can anyone help me?
javascript node.js
marked as duplicate by Felix Kling
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 2 at 20:21
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
transactions = JSON.parse(transactionsIds); json["txid"]); thy this.
– theantomc
Jan 2 at 20:24
1
You need to map it: console.log({ tx: info.transactions.map(x => x.txid) })
– rjanjic
Jan 2 at 20:26
Thanks to both of you friends. Both answers resolved the problem. Excellent.
– alibag90
Jan 2 at 21:00
add a comment |
This question already has an answer here:
From an array of objects, extract value of a property as array
13 answers
Access / process (nested) objects, arrays or JSON
20 answers
I'm new to nodejs. I now have a code like this.
client.listSinceBlock(hash, function(err, info) {
if (err) {
console.error('Unable to get block info for: ', hash, ' got error: ', err);
return callback(err);
}
var transactionsIds = info;
console.log('txids ', transactionsIds);
});
which answers the bellow response :
{ transactions:
[ { account: '',
txid: '925cb1434f64567539896ee370b8dfca7c46d5c0a7482f2ce85d8a9fea976411',
abandoned: false },
{ account: '',
txid: 'afda7a1d90310c8fea22dff809062c72754e58e1a1918a55e210c59ad8a9b11c',
'bip125-replaceable': 'no' },
{ account: '',
txid: '30053a0b819f03bc37626468ce27b718140ce2db6c054c84899c7db0cb62fa26',
'bip125-replaceable': 'no',
abandoned: false },
],
removed: ,
lastblock: 'some data' }
But i need parse TXIDs from this response like below :
{
"tx": [
"925cb1434f64567539896ee370b8dfca7c46d5c0a7482f2ce85d8a9fea976411",
"afda7a1d90310c8fea22dff809062c72754e58e1a1918a55e210c59ad8a9b11c",
"30053a0b819f03bc37626468ce27b718140ce2db6c054c84899c7db0cb62fa26"
],
}
Can anyone help me?
javascript node.js
This question already has an answer here:
From an array of objects, extract value of a property as array
13 answers
Access / process (nested) objects, arrays or JSON
20 answers
I'm new to nodejs. I now have a code like this.
client.listSinceBlock(hash, function(err, info) {
if (err) {
console.error('Unable to get block info for: ', hash, ' got error: ', err);
return callback(err);
}
var transactionsIds = info;
console.log('txids ', transactionsIds);
});
which answers the bellow response :
{ transactions:
[ { account: '',
txid: '925cb1434f64567539896ee370b8dfca7c46d5c0a7482f2ce85d8a9fea976411',
abandoned: false },
{ account: '',
txid: 'afda7a1d90310c8fea22dff809062c72754e58e1a1918a55e210c59ad8a9b11c',
'bip125-replaceable': 'no' },
{ account: '',
txid: '30053a0b819f03bc37626468ce27b718140ce2db6c054c84899c7db0cb62fa26',
'bip125-replaceable': 'no',
abandoned: false },
],
removed: ,
lastblock: 'some data' }
But i need parse TXIDs from this response like below :
{
"tx": [
"925cb1434f64567539896ee370b8dfca7c46d5c0a7482f2ce85d8a9fea976411",
"afda7a1d90310c8fea22dff809062c72754e58e1a1918a55e210c59ad8a9b11c",
"30053a0b819f03bc37626468ce27b718140ce2db6c054c84899c7db0cb62fa26"
],
}
Can anyone help me?
This question already has an answer here:
From an array of objects, extract value of a property as array
13 answers
Access / process (nested) objects, arrays or JSON
20 answers
javascript node.js
javascript node.js
asked Jan 2 at 20:19
alibag90alibag90
717
717
marked as duplicate by Felix Kling
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 2 at 20:21
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Felix Kling
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 2 at 20:21
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
transactions = JSON.parse(transactionsIds); json["txid"]); thy this.
– theantomc
Jan 2 at 20:24
1
You need to map it: console.log({ tx: info.transactions.map(x => x.txid) })
– rjanjic
Jan 2 at 20:26
Thanks to both of you friends. Both answers resolved the problem. Excellent.
– alibag90
Jan 2 at 21:00
add a comment |
transactions = JSON.parse(transactionsIds); json["txid"]); thy this.
– theantomc
Jan 2 at 20:24
1
You need to map it: console.log({ tx: info.transactions.map(x => x.txid) })
– rjanjic
Jan 2 at 20:26
Thanks to both of you friends. Both answers resolved the problem. Excellent.
– alibag90
Jan 2 at 21:00
transactions = JSON.parse(transactionsIds); json["txid"]); thy this.
– theantomc
Jan 2 at 20:24
transactions = JSON.parse(transactionsIds); json["txid"]); thy this.
– theantomc
Jan 2 at 20:24
1
1
You need to map it: console.log({ tx: info.transactions.map(x => x.txid) })
– rjanjic
Jan 2 at 20:26
You need to map it: console.log({ tx: info.transactions.map(x => x.txid) })
– rjanjic
Jan 2 at 20:26
Thanks to both of you friends. Both answers resolved the problem. Excellent.
– alibag90
Jan 2 at 21:00
Thanks to both of you friends. Both answers resolved the problem. Excellent.
– alibag90
Jan 2 at 21:00
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
transactions = JSON.parse(transactionsIds); json["txid"]); thy this.
– theantomc
Jan 2 at 20:24
1
You need to map it: console.log({ tx: info.transactions.map(x => x.txid) })
– rjanjic
Jan 2 at 20:26
Thanks to both of you friends. Both answers resolved the problem. Excellent.
– alibag90
Jan 2 at 21:00