I am facing a challenge in exporting an array of JSON objects to CSV as the number of key-value pairs can vary, leading to additional columns in some objects. Currently, I am using the Angular2CSV package for export functionality, but it requires all columns to be included.
Below is the code snippet that showcases my current approach where the service provides the data to be downloaded.
private exportTable(){
this.service.exportDataForDownload().then(response => {
let csvFileName = "Results";
new Angular2Csv(response, csvFileName, {headers: this.tableheaders});
});
}