csv-to-json
Converts your csv into json structure
Dependencies
fs
Usage
Parse a csv file like this:
var csv = require("./csv.js");
var json = csv.parse('path/to/file');
Writes the parsed file to a file like this:
csv.write('path/to/file');
By default, a report is sent to the console (“Parsed Items: #” for .parse()
; “File saved” for .write()
). You can pass an config object as a second argument with console: false
to bypass this behavior. Like so:
var config = {
console: false
}
var json = csv.parse('path/to/file', config);
csv.write('path/to/file', config);