json-csv-transformer
transform json to csv, and vice versa
Install
npm install json-csv-transformer --save
Use
const csv = schema: key: 'xxx' label: 'XXX' type: 'string' // parse data, csv or jsoncsv// get file dataURLcsv// transform to JSONcsv
find more use case, please see test
Schema
field | type | required | description |
---|---|---|---|
key |
string |
true |
key for this schema |
label |
string |
false |
it will display in the header |
type |
string | boolean | date | number |
false |
default type is string , it will be ignored if formatter is present |
formatter |
{csv: function, json: function} |
false |
custom formatter, csv for transform to csv , json for transform to json |