A user press a button and it executes a SQL query to my database using NodeJS and the result is a JSON object (one array with objects). After that the result must be saved in a file (the user need the file).
The problem: it can't be a JSON. The format is only the values separated by the simbol ";" and one object per line.
Example of the file's content that I need to create (it is like a CSV):
1;tree;green
2;car;red
3;Robert's house;white
This result query has around 18000 rows. It is big.
I am using the replace method but I have problems with values with the simbol ' like in Robert's house because the console interpreted as a begining of a string.
Then in the client side I use:
$window.open('data:text/csv,' + encodeURIComponent(myString));
And here the simbols ' start the problem.
I would like to know how to transform a JSON to that format (under NodeJS) and how to create the file.