![my csv](https://i.stack.imgur.com/v5oDq.png)
У меня возникли проблемы с загрузкой данных в csv, я хочу, чтобы [объект объекта] изменился на строку в файле csv. но я попробую код, результат не определен.
это мой формат JSON, я беру только один пример данных
[
{
"id": 117,
"code": "RR123",
"dueDate": "2018-06-25T09:51:00",
"isActive": true,
"inspectors": {
"id": 67,
"employeeNumber": "18001",
"name": "Larks Anderson",
"isActive": true
},
"questioners": {
"id": 63,
"code": "PI190",
"name": "Inspeksi Door",
"isActive": true,
"questionerDetails": [
{
"id": 124,
"questionDetail": "",
"isActive": true
}
]
}
},
]
Это мой код в component.ts
//Button CSV
getcsvFile() {
this.workorderService.getAllWorkOrder().subscribe(data => {
this.allpagingData = [];
let questionerlabel: any;
for (let index in data) {
console.log(data[index].questioners);
//i use this to change the [object Object], but the result is undefined in csv
for (let ai in data[index].questioners) {
questionerlabel = data[index].questioners[ai].name;
console.log(questionerlabel);
}
this.allpagingData.push({
"code": data[index].code,
"inspectors": data[index].inspectors,
"questioners": questionerlabel,
"dueDate": data[index].dueDate,
"isActive": data[index].isActive
});
}
var option = {
fieldSeparator: ',',
quoteStrings: '"',
decimalseparator: '.',
showLabels: true,
showTitle: true,
headers: ['WO Code' , 'Inspectors', 'Questioner', 'Date', 'Status']
}
new Angular2Csv(this.allpagingData, 'WorkOrder Report', option)
});
}
как же изменить [объект Object] на строку?