Parse csv to json and vice versa

I have written a JavaScript library to convert JSON to CSV and back. It has no dependencies and only works with flat objects.

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

Sources on Sourcehut and GitHub.