jsonconverter

1.0.4 • Public • Published

jsonconverter

A Nodejs module that converts csv to json.

Installation:

$ npm i jsonconverter

API

.csvToJson(csvData, option, callback( err, data ){ }) option parameter:

  • fromFile: set true if you are passing data through file.
  • toFile: : set true if you want output in the form of file.

Examples

Conversion of raw csv to raw json as output.

var jsonc = require('@asthajadia12/jsonconverter');
 
jsonc.csvToJson(csvData, {},
  function (err, data) {
      return data; // returns raw data
})

Conversion of csv file data to raw json as output.

jsonc.csvToJson(csvFilePath, { fromFile: true },
  function (err, data) {
      return data; // returns raw data
})

Conversion of csv file data to json file as output.

jsonc.csvToJson(csvFilePath, { fromFile: true, toFile: true },
  function (err, data) {
      return data; // returns output as output.json in currenct directory
})

License

MIT

Package Sidebar

Install

npm i jsonconverter

Weekly Downloads

2

Version

1.0.4

License

MIT

Unpacked Size

6.33 kB

Total Files

9

Last publish

Collaborators

  • asthajadia12