Convert JSON
A collection of converting multiple formats of files to JSON.
Support
- csv, tsv, dsv.. (using
stream
) - xlsx (using
readFile
) - xls (using
readFile
) - xml (using
readFile
)
Install
npm install convert-json
Usage
CSV
var cv2json = ; var csv_trans = cv2json
The first argument is a csv input file, for options see details https://github.com/chilijung/CSVstream#options-csvstreamoptions, and the last argument is a callback function.
XLS
var cv2json = ; var csv_trans = cv2json
The first argument is a xls input file, for options see details https://github.com/SheetJS/js-xls#parsing-options, and the last argument is a callback function.
XLSX
var cv2json = ; var csv_trans = cv2json
The first argument is a xlsx input file, for options see details https://github.com/SheetJS/js-xlsx#parsing-options, and the last argument is a callback function.
XML
var cv2json = ; var csv_trans = cv2json
The first argument is a xml input file, for options see details https://github.com/Leonidas-from-XIV/node-xml2js#options, and the last argument is a callback function.
Library using
- csv
https://github.com/chilijung/csvstream
- xlsx
https://github.com/SheetJS/js-xlsx
- xls
https://github.com/SheetJS/js-xls
- xml
https://github.com/Leonidas-from-XIV/node-xml2js
License
MIT