arrays - 邮递员测试 - 验证数组中的值
问题描述
我在 Postman 中有一个测试,我可以在其中验证数组中的值。我遇到的问题是返回的值可以是随机的。这就是我正在验证的 json 的样子。
[
{
"id": "7776",
"revision": {
"revisionId": "7780",
"createdByUserId": "Lakare12",
"createdDateTime": "2020-07-29T16:49:34.000+05:30"
},
"identifiers": [
{
"system": "urn:oid:1.2.752.129.2.1.4.1",
"value": "CDE473Child1",
"use": "primary",
"displayValue": null
}
],
"name": "AA Child 01",
"active": true,
"hasChildren": false,
"parentUnitId": "7768"
},
{
"id": "7783",
"revision": {
"revisionId": "7783",
"createdByUserId": "Lakare12",
"createdDateTime": "2020-07-30T08:47:40.000+05:30"
},
"identifiers": [
{
"system": "urn:oid:1.2.752.129.2.1.4.1",
"value": "CDE473Child3",
"use": "primary",
"displayValue": null
}
],
"name": "BB main Child 03",
"active": true,
"hasChildren": false,
"parentUnitId": "7768"
}
]
我需要测试该名称包含BB main Child 03
解决方案
您可以遍历数组并检查每个数组元素中的名称。
推荐阅读
- excel - Excel中的逐个单元格条件格式
- r - rshiny ui中for循环内的逗号
- android - 如何在音乐播放器android中实现黑名单文件夹
- python - Python - Pandas 数据框表/列结构
- amazon-web-services - “无法与 AWS CodeCommit 协商”:“找不到匹配的主机密钥类型”
- javascript - 为什么我的消息收集器收集相同的消息?
- postgresql - 如何从 jsonb 中删除所有值为 null 的元素?
- c++ - 在(排序的)循环数据结构中搜索值的快速方法
- c - 错误的文件描述符:accept() 错误(套接字)
- r - 使用 tidymodels 计算所有类别的预测值