const { Parser } = require('json2csv'); const json2csvParser = new Parser({ unwind: paths, unwindBlank: true, flatten: true, flattenSeparator: '__' }); const csv = json2csvParser.parse(myData);