hussain hussain - 1 month ago 8
Javascript Question

How to get data from array of object?

Below

data
is printed in
console.log
, How can i print header from this array i tried below approach but i got error map is not a function, So this is server side
nodejs
, How can i get
headers
object from
data
?

server.js

console.log(data);

var result = data.map(function(a) {return a.fieldName;});

{ file:
[ { fieldName: 'file',
originalFilename: 'sco_poc.bpmn',
path: 'yGCNPv.bpmn',
headers: [Object],
size: 11078 } ] }

XYZ XYZ
Answer
console.log(data.file[0].headers);

try this

OR This

var result = data.file.map(function(a) {
       console.log(a.headers);
        return a.headers;
 });
Comments