npm install csv-manager
Import the package
const csv_manager = require('csv-manager');csv_manager.toCSV(jsonArray,separator,path);And your csv file will be saved in the path you wrote!
Having the json array
var people=[
{name: 'Bruce', surname: 'Wayne'},
{name: 'Clark', surname:'Kent'},
{name: 'Peter', surname: 'Parker'}
]Use the function toCSV() to get your CSV file, using the separator you want, in this example we are using comma (,)
csv_manager.toCSV(people, ',' ,'people.csv');And your CSV file will be ready!