📅  最后修改于: 2022-03-11 15:04:25.488000             🧑  作者: Mango
const { Parser } = require('json2csv'); const fields = ['field1', 'field2', 'field3'];const opts = { fields }; try { const parser = new Parser(opts); const csv = parser.parse(myData); console.log(csv);} catch (err) { console.error(err);}