我从一项服务中得到以下回应。 我可以在控制台中看到但无法进行迭代的响应。
{
"input": {
"personId": "0519769867"
},
"output": {
"error": null,
"customerName": "ANDERSON, JACQUELINE",
"customerRole": "P",
"customerEmail": "test.1@gmail.com",
"contactNumber": "(789) 989-0001",
"accountList": [
{
"accountInfo": {
"accountId": "9444378190",
"currentBalance": null,
"payoffBalance": null,
"currency": "USD",
"serviceAgreements": [
{
"serviceInfo": {
"saId": "9445462369",
"saStatus": "10",
"serviceType": "WATER",
"saStartDt": "2018-09-11",
"saEndDt": "2019-01-24"
}
}
]
}
}
]
},
"dateTimeTagFormat": "xsd:strict"
}
this._freeapiservice.getPostComments(opost).subscribe((response:Response)=>{
this.respnseData = Object.keys(response);
for (const key in response) {
if (this.respnseData[key] == 'output' ){
console.log("response data for output "+this.respnseData[key]);
}
}
我想从输出键中获取所有单个数据,并在ui上填充
答案 0 :(得分:0)
您可以通过以下方式简单地打印output
键:
this._freeapiservice.getPostComments(opost).subscribe((response: Response) => {
console.log("response data for output " + response.output);
})