Use es7 async to convert json to csv form data
npm install async-json2csv``
var json2csv = require('async-json2csv');
var authors = [{
name: 'solee',
homepage: 'http://solee.me',
repo: {
url: 'https://github.com/solee0524/async-json2csv.git',
type: 'git'
},
keys: ['coo"l', 'lol']
}, {
name: 'solee_clone',
homepage: 'http://solee.me',
repo: {
url: 'https://github.com/solee0524/async-json2csv.git',
type: 'git'
},
keys: ['clone', 'myth']
}];
var options = {
data: authors,
fields: ['name', 'homepage', 'repo.url', 'keys'],
header: true
}
var csv = await json2csv(options);
`
data and fields in options must be Array
Fix comma stuff.
Add header` option to decide whether to add fields to header or not.