
I'd expect all the array will be converted to json string. And using the create JSON module, I'd try to convert the array into JSON string. Using the Array aggregator, I'd combine those bundles into an array. I have the naming of the fields static here, but you could use code to set the headers dynamically: for(var j=0 jcsv to jsonĬonst row = e.replace(/++|++/g, ',').trim() CSVJSON - CSVJSON The easy, confidential online data converter Csvjson helps you quickly convert popular data formats to the format you need. For instance, we can get a CSV from a file and convert it to JSON as follows: person.csv firstname,lastnamejohn,smithjane,smith index.js const csvFilePath person. You can modify the code above to allow for varying and more complex CSV data.I think, I have a better solution, this also have one issue i.e. Index.js import csvToJson from 'csvtojson' const csvFilePath = 'data.csv' const json = await csvToJson().fromFile(csvFilePath) console.log(json) ĭata.csv color,maxSpeed,age "red",120,2 "blue",100,3 "green",130,2 Data pasted and converted remains local on your computer. You can the csvtojson library to quickly convert CSV to JSON in JavaScript: CSVJSON - CSVJSON The easy, confidential online data converter Csvjson helps you quickly convert popular data formats to the format you need. Sample code: Return table data as JSON with hyperlink text.