node.js - Node js read a value from json array -
async.series([ function(callback){ geen.api('openorders', function(error, data) { callback(null, data.result['open']); if(error) { console.log(error); } }); } ], function(err, results){ console.log(results[0]['ojvbce-kz7sx-snnaap'].status) // undefined }); });
returns json:
[{ 'ojvbce-kz7sx-snnaap': { refid: null, userred: null, status: 'open', opentm: 1397461378.8155 } }]
how acces this? example: results['ojvbce-kz7sx-snnaap'].status undefined.
it's array , ojvbce-kz7sx-snnaap @ first position so:
results[0]['ojvbce-kz7sx-snnaap'].status
if access way show have have array formed this:
var results = []; results['ojvbce-kz7sx-snnaap'] = { refid: null, userred: null, status: 'open', pentm: 1397461378.8155 }
now results['ojvbce-kz7sx-snnaap'].status work
Comments
Post a Comment