node-csvtojson
node-csvtojson copied to clipboard
Async / await issue?
Trying to get converted to json string with node-csvtojson. Why node-csvtojson do not return converted to json string at async mode?
Code example
modeule.exports = async (req, res, next) => {
const strindWithDelimiter='bla;bla;bla'
const csv=require('csvtojson')
// Async / await usage
const jsonArray=await csv().fromString(strindWithDelimiter);
console.log( jsonArray); <--- receive empty object wtihs node-csvtojson custom options
}
Hi, What version of csvtojson you are using? Also are you using es7 or typescript?
~Keyang
es7, "csvtojson": "^1.1.9"
Yep! Thanks! I've been updated to lates version, and everything goes fine!