Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

convert-json

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

convert-json

A collection of converting multiple formats of files to JSON.

  • 0.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
88
increased by44.26%
Maintainers
1
Weekly downloads
 
Created
Source

Convert JSON

Build Status

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 = require('../');

var csv_trans = cv2json.csv('./test/test.csv', options /* optional */, function(err, result) {
  if(err)
    console.error(err);
  else 
    console.log(result);
    // result should be a json object or array.
})

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 = require('../');

var csv_trans = cv2json.xls('./test/test.xls', options /* optional */, function(err, result) {
  if(err)
    console.error(err);
  else 
    console.log(result);
    // result should be a json object or array.
})

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 = require('../');

var csv_trans = cv2json.xlsx('./test/test.xlsx', options /* optional */, function(err, result) {
  if(err)
    console.error(err);
  else 
    console.log(result);
    // result should be a json object or array.
})

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 = require('../');

var csv_trans = cv2json.xml('./test/test.xml', options /* optional */, function(err, result) {
  if(err)
    console.error(err);
  else 
    console.log(result);
    // result should be a json object or array.
})

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

Keywords

FAQs

Package last updated on 27 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc