Home Reference Source

json-csv-transformer

transform json to csv, and vice versa

node npm license Build Status Standard - JavaScript Style Guide bitHound Overall Score bitHound Dependencies bitHound Dev Dependencies Coveralls github

Install

npm install json-csv-transformer --save

Use

const CSV = require('json-csv-transformer')

const csv = new CSV({
  schema: [{
    key: 'xxx',
    label: 'XXX',
    type: 'string',
  }]
})

// parse data, csv or json
csv.parse(data)
// get file dataURL
csv.getDataURL()
// transform to JSON
csv.toJSON()

find more use case, please see test