When I download my data into a CSV file, the display setting is showing as "[object Object]". This is not the desired outcome.
https://i.stack.imgur.com/ej2UO.png
The expected display should look like this:
https://i.stack.imgur.com/8JJ88.png
This is part of my JavaScript code:
$scope.download = function () {
var csv = jsonToCsv(['ThemeName', 'DataSharing',
'DisplaySetting', 'ExpiryDate', 'Icon',
'PublishDate','QueryName','ThemeName', 'ThemeOwner'], health)
var csvBlob = new Blob([csv], { type: 'text/csv' });
saveAs(csvBlob, 'json.csv');
};
Could someone please advise on how to modify this code to display the object correctly in the CSV file? Is there a way to customize which objects are displayed in the CSV file?
I would be grateful for any assistance or guidance. I am open to changing my coding approach if it leads to a solution. Any recommended resources would also be highly appreciated. Thank you!
Here is an example of using JSON.stringify:
else if ($scope.all[i].CATEGORY == 'Health')
{
health.DISPLAY_SETTING =
JSON.stringify(health.DISPLAY_SETTING)
health.push($scope.all[i]);
}