0

I have a API with NodeJS

I want to print into a CSV File a Object like this

[
 {
  "birthday":"1992-01-01",
  "email":"test@mail.com",
  "gender":"male"
 },
 {
  "birthday":"2000-03-23",
  "email":"test2@mail.com",
 }
]

And I want this in my CSV File

birthday,email,gender
1992-01-01,test@gmail.com,male
2000-03-23,test2@mail.com

For print CSV I using

var hiddenElement = document.createElement('a');
hiddenElement.href = 'data:attachment/csv,' + encodeURI(show);
hiddenElement.target = '_blank';
hiddenElement.download = 'result.csv';
hiddenElement.click();

But in the CSV file prints [Object object]

ANy help? Thanks!

ZizouJd
  • 79
  • 3
  • 12
  • Did you search? [`[javascript] object to csv`](https://stackoverflow.com/search?q=%5Bjavascript%5D+object+to+csv) – Felix Kling Sep 17 '16 at 23:34
  • Yes I do, but I have found not work totally for me – ZizouJd Sep 17 '16 at 23:36
  • Then please explain which solutions you have tried and why they do not work. E.g. why does the function in http://stackoverflow.com/q/4130849/218196 not work for you? – Felix Kling Sep 17 '16 at 23:42

0 Answers0