I have a return from a query that I am pushing to a dgrid.  That works fine.
I want to take this json return and convert it to .csv  I tried the code below and sent to an alert and it puts a comman after each character???
json simplify:

var json = JSONObject;	 
var csv = "";
		
function toCSV(json) {
	alert("In Function");
	json = Object.values(json);
	var keys = (json[0] && Object.keys(json[0])) || [];
	csv += keys.join(',') + '\n';
	for (var line of json) {
	    csv += keys.map(key => line[key]).join(',') + '\n';
	}
	return csv;
}
toCSV(json);
alert(csv);
This is the return I get when I alert the CSV variable....
