CSV to JSON converter
simply and fast converter that can be used as module
Description
CSV look like:
name | age | sex | address |
---|---|---|---|
John | 18 | M | NY, Brooklyn |
Alice | 22 | F | Britan, Newington |
Text with will look like: (delimiter: ",")
name,age ,sex,adderssJohn,18,M,"NY, Brooklyn"Alice,22,F,"Britan, Newington"
simply call function csvToJson() with at least one parametr
const csvText = 'name,age,sex,adderss\nJohn,18,M,"NY, Brooklyn"\nAlice,22,F,"Britan, Newington"';const delimiter = ','; //wit delimiterconst json = csvToJson(csvText, delimiter); //you can call it without dilimiter if it is: , ; | " "const json = csvToJson(csvText);
It will generate JSON like this:
Install npm
csvtojson-converter
link on NPM:npm install csvtojson-converter -D