JavaScript library to convert JSON to CSV and back. Has no dependencies. Only works with flat objects.
If you use npm, npm install @onelastjedi/json2csv
. You can also download the latest release on GitHub.
import parse from '@onelastjedi/json2csv'
const csv = 'name,developer,age\nMary,true,25'
const json = { name: 'John', developer: false, age: 30 }
parse.csv2json(csv) // [{ name: 'Mary', developer: true, age: 25}]
parse.json2csv(json) // name,developer,age\nJohn,false,30