CSV TO JSON Conversion using Javascript Use the below code and then use command "node filename.js", this would generate a JSO...
CSV TO JSON Conversion
By VSquare
CSV TO JSON Conversion using Javascript
Use the below code and then use command "node filename.js", this would generate a JSON file which is converted from CSV.
Install this library before using the below script
const csvtojson = require('csvtojson')
const fs = require('fs')
const csvfilepath = "./CustomerData.csv"
csvtojson()
.fromFile(csvfilepath)
.then((json) => {
console.log(json)
fs.writeFileSync("./cypress/fixtures/output.json",JSON.stringify(json),"utf-8",(err) => {
if(err) console.log(err)
})
})
Test Engineer dedicating this blog to a glorified soul who was like part of my family and disappeared. Hoping she would talk to me some day. Wishing her all the best, success and good luck for a bright and prosperous future.
0 comments: