【发布时间】:2021-11-09 22:35:20
【问题描述】:
我有一个关于 json 对象的响应,并且只想保存我从之前的请求中获得的 hpr 编号“431002790”的 id。回复如下:
[
{
"id": "39d927fd-c634-45ab-b03c-17a1f0309576",
"fullName": "Ali Fos Domus",
"hpr": 431002235,
"role": "Doctor"
},
{
"id": "30ef1935-7999-4d44-bf21-17a1f03224cd",
"fullName": "Bengt Fos Minde",
"hpr": 431002790,
"role": "Doctor"
},
{
"id": "d590bac9-7aad-49d5-9a02-17a1f0316b72",
"fullName": "Bengt Fos Mo",
"hpr": 6165222,
"role": "Doctor"
}
我尝试过类似的方法:
.check(jsonPath("$..[?(@.hpr==\"431002790\")].id").saveAs("idHp")))
但我猜可能json结构的顺序可能有问题?
【问题讨论】: