3.0.2 • Published 5 years ago

json-csv-transformer v3.0.2

Weekly downloads
6
License
MIT
Repository
github
Last release
5 years ago

json-csv-transformer

transform json to csv, and vice versa

node npm license Build Status Standard - JavaScript Style Guide Coveralls Status

Install

npm install json-csv-transformer --save

Use

import CSV from '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

Schema

fieldtyperequireddescription
keystringtruekey for this schema
labelstringfalseit will display in the header
typestring | boolean | date | numberfalsedefault type is string, it will be ignored if formatter is present
formatter{csv: function, json: function}falsecustom formatter, csv for transform to csv, json for transform to json
3.0.2

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.4.0

5 years ago

2.3.0

6 years ago

2.2.0

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago