i read the json2csv documentation and applied it in my program
const {parse} = require('json2csv')
header = [customerNo,Name,BranchCode,representive,overall]
list = [{cNo:1,name:Jack,bCode:3,rps:Bill,overall},{cNo:2,name:Justin,bCode:2,rps:Wade,overall:180}]
const fields = header;
const opts = { fields };
try {
var csv = parse(list,opts);
csv=csv.replace(/,/g,";")
console.log(csv);
} catch (err) {
console.log(err)
}
result = customerNo;Name;BranchCode;representive;overall
My data not coming under headers. Why I have this problem. Am I doing something wrong ?