给出下面的json响应。
{
"status": "success",
"data": {
"cheapest": {
"data": [
{
"logistic_id": 1,
"rate_id": 21
}
]
},
"reguler": {
"data":[
{
"logistic_id": 5,
"rate_id": 74
}
]
},
"ranked": {
"data": []
}
}
}
要获取logistic_id值并存储到logisticIdValue,我使用路径:
set("logisticIdValue", x.data.reguler.data[0].logistic_id)
我想使用迭代从响应中获取logistic_id值,这样我就不必编写const cheost、reguler和ranked来进行迭代。它可能涉及key
语法,类似于此,但我不知道什么是正确的语法
set("logisticIdValue", x.data.key[1].data[0].logistic_id)
1条答案
按热度按时间nnsrf1az1#