Javascript 对象不接受 JSON



我有以下脚本:

const [firstResponse, secondResponse] = await Promise.all([
this.$store.dispatch(Actions.RELATIONS),
ApiService.get("/api/"+ this.apiEndpointSingle +'/'+this.uid)
]);
console.log(secondResponse)
this.formData = secondResponse.data.result[this.apiEndpointSingle];

如果我控制台记录secondResponse(它使键处的有效JSON值为空(。我该怎么解决这个问题?在我看来,这很糟糕。我以前从未见过。

输出API:

{
"id": 1,
"created_at": "2021-06-15T12:10:41.000000Z",
"updated_at": null,
"created_by": 1,
"status": 1,
"uid": null,
"tags": "["2"]",
"sale_status": "completed",
"reference": "test1",
"sale_date": "2021-06-17T14:33:00.000000Z",
"currency": null,
"connection_id": null,
"relation_id": 1,
"profile_id": 1,
"address_id": 1,
"profile_name": "P1",
"relation_name": "R1"
}

控制台记录变量secondResponse:后的输出

{
"id": 1,
"created_at": "2021-06-15T12:10:41.000000Z",
"updated_at": null,
"created_by": 1,
"status": 1,
"uid": null,
"tags": [],
"sale_status": "completed",
"reference": "test1",
"sale_date": "2021-06-17T14:33:00.000000Z",
"currency": null,
"connection_id": null,
"relation_id": 1,
"profile_id": 1,
"address_id": 1,
"profile_name": "P1",
"relation_name": "R1"
}

我解决了这个问题。这与剧本的这部分没有任何关系。它是一个v模型系统,用于事后替换数据。

最新更新