Closed alziqziq closed 7 years ago
The response is probably not what you think it is. Put a console log there and paste the result here.
the problem is because the column name is different from the database column name.
how do I custom the column names?
See the documentation for the fields parameter here https://github.com/zemirco/json2csv/blob/master/README.md#example-fields-option
var fields = ['car', 'price'];
User.all().then((response) => { var data = json2csv({data : response, fields : fields}); console.log(data); // Output data : // "car","price" //, //, });
whats wrong?