I need to read a .csv file and convert the csv file to json format and pass the json to frontend
which is the best way to read a csv file and convert to json
Here my code is:
fs.readFile(req.files.file.path, function(ferr, file) {
if (ferr) {
res.json(HttpStatus.NOT_FOUND, { error: ferr });
}
if (file) { //here i will get my file
//here i need to write code for convert the csv file to json
}
Copyright Notice:Content Author:「Prakash」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/52400426/how-to-convert-csv-file-to-json