Below is example for exporting JSON to CSV:
import { Angular7Csv } from 'angular7-csv/Angular7-csv';
var data = [
{
name: "Test 1",
age: 13,
average: 8.2,
approved: true,
description: [{"Status": "Pass", "TimeStamp": "2019-03-12 08:19:50", "UserID": "KG19932"}]
},
{
name: 'Test 2',
age: 11,
average: 8.2,
approved: true,
description: [{"Status": "Pass", "TimeStamp": "2019-03-12 08:19:50", "UserID": "KG19932"}]
},
{
name: 'Test 4',
age: 10,
average: 8.2,
approved: true,
description: [{"Status": "Pass", "TimeStamp": "2019-03-12 08:19:50", "UserID": "KG19932"}]
}
];
new Angular7Csv(data, 'My Report');
.csv file getting downloaded successfully but in Description column value getting as [object object]. I have tried JSON.stringify and JSON.Parse but no luck. Anyone has solution for this??
just stringfy the description
data.forEach(x=>{
x.description=JSON.stringify(x.description);
});
new Angular7Csv(data, 'My Report');