当前位置: 首页 > 面试题库 >

JSON路径提取器:JSON路径表达式

华坚成
2023-03-14
问题内容

JSON Path Expression应该是什么来获取beneficiary_ids

beneficiaryType = OtherBankCustomer.
My Json response is as follows:
{
    "busBeneficiaryBeanList": [{
        "beneficiary_serial_no": 0,
        "beneficiary_id": "2090",
        "senderMobileNo": null,
        "beneficiaryName": "Shibashish Dash",
        "beneficiaryNickName": "Shib",
        "beneficiaryType": "WalletCustomer",
        "beneficiaryMobileNo": "9778697852",
        "status": "Active",
        "time": null,
        "accountno": "8093630503",
        "ifsccode": null,
        "bankType": null,
        "bankName": null,
        "address1": "testtesttest",
        "address2": "ewretrytutyutyityju",
        "address3": "fdfdddffr",
        "wPin": null,
        "randomNumber": null
    }, {
        "beneficiary_serial_no": 0,
        "beneficiary_id": "2113",
        "senderMobileNo": null,
        "beneficiaryName": "Girija",
        "beneficiaryNickName": "Girija",
        "beneficiaryType": "WalletCustomer",
        "beneficiaryMobileNo": "9861032490",
        "status": "Active",
        "time": null,
        "accountno": null,
        "ifsccode": null,
        "bankType": null,
        "bankName": null,
        "address1": "fdgfrhrgrbhegfbsdgb",
        "address2": null,
        "address3": null,
        "wPin": null,
        "randomNumber": null
    }, {
        "beneficiary_serial_no": 0,
        "beneficiary_id": "2102",
        "senderMobileNo": null,
        "beneficiaryName": "Sonu",
        "beneficiaryNickName": "Sonu",
        "beneficiaryType": "OtherBankCustomer",
        "beneficiaryMobileNo": "8093630503",
        "status": "Active",
        "time": null,
        "accountno": "12365478969",
        "ifsccode": "SBIN0000000",
        "bankType": null,
        "bankName": null,
        "address1": "qwertyuiop",
        "address2": "asdfghjkll",
        "address3": null,
        "wPin": null,
        "randomNumber": null
    }, {
        "beneficiary_serial_no": 0,
        "beneficiary_id": "2103",
        "senderMobileNo": null,
        "beneficiaryName": "kajal",
        "beneficiaryNickName": "kajal",
        "beneficiaryType": "OtherBankCustomer",
        "beneficiaryMobileNo": "8093630503",
        "status": "Active",
        "time": null,
        "accountno": "12365477777",
        "ifsccode": "SBIN0000000",
        "bankType": null,
        "bankName": null,
        "address1": "qwertyuiop",
        "address2": "asdfghjkll",
        "address3": null,
        "wPin": null,
        "randomNumber": null
    }, {
        "beneficiary_serial_no": 0,
        "beneficiary_id": "2104",
        "senderMobileNo": null,
        "beneficiaryName": "Ajay",
        "beneficiaryNickName": "Ajay",
        "beneficiaryType": "OtherBankCustomer",
        "beneficiaryMobileNo": "8093630503",
        "status": "Active",
        "time": null,
        "accountno": "12365477775",
        "ifsccode": "SBIN0000000",
        "bankType": null,
        "bankName": null,
        "address1": "qwertyuiop",
        "address2": "asdfghjkll",
        "address3": null,
        "wPin": null,
        "randomNumber": null
    }, {
        "beneficiary_serial_no": 0,
        "beneficiary_id": "2111",
        "senderMobileNo": null,
        "beneficiaryName": "devgan",
        "beneficiaryNickName": "devgan",
        "beneficiaryType": "OtherBankCustomer",
        "beneficiaryMobileNo": "8093630503",
        "status": "Active",
        "time": null,
        "accountno": "123456789012",
        "ifsccode": "BKDN0999848",
        "bankType": null,
        "bankName": null,
        "address1": "qwertyuiop",
        "address2": "asdfghjkll",
        "address3": null,
        "wPin": null,
        "randomNumber": null
    }, {
        "beneficiary_serial_no": 0,
        "beneficiary_id": "2112",
        "senderMobileNo": null,
        "beneficiaryName": "Sony",
        "beneficiaryNickName": "Sony",
        "beneficiaryType": "DenaAccountCustomer",
        "beneficiaryMobileNo": "8093630503",
        "status": "Active",
        "time": null,
        "accountno": "005013023756",
        "ifsccode": null,
        "bankType": null,
        "bankName": null,
        "address1": "Near Sai temple",
        "address2": "SBI ATM",
        "address3": "SS bihar",
        "wPin": null,
        "randomNumber": null
    }],
    "busPasswordPolicyBean": {
        "minLen": 1,
        "maxLen": 2,
        "minNumRqd": 1,
        "minUpperCaseChars": 0,
        "minLowerCaseChars": 0,
        "minSpclChars": 0,
        "spclCharSet": "#@",
        "pwdType": "SecretCode",
        "lastUpdatedOn": 1497433024653,
        "updatedBy": "1234"
    }

}

问题答案:

您所需的JSON路径表达式将如下所示:

$.busBeneficiaryBeanList[?(@.beneficiaryType=='OtherBankCustomer')].beneficiary_id


 类似资料:
  • 假设我有这个流行的数据样本。 我想从这里得到的是一本所有的<代码>书,其中<代码>类别==小说和所有的<代码>自行车,其中<代码>颜色==红色。 也就是说,我想要, 我知道,我可以用实现有针对性的书籍和

  • 问题内容: 我一直在尝试获取本地文件的正确路径。我有以下目录: 我在执行从与JS代码: 但这是行不通的,甚至警报也没有开始。怎么了? 我也尝试过这个: 在这种情况下,警报未定义。 问题答案: 由于它位于目录中,因此您需要执行以下操作: 文件路径是 纯JS:

  • 如何为下面的JSON编写mockMVC测试,该JSON具有String和Array的组合。 我的代码: 我有个例外 JSON路径“$.accounts.id”处无值,异常: 应在路径$中找到属性为['accounts']的对象,但找到'net'。米尼德夫。json。杰索纳雷'。根据JsonProvider:'com,这不是json对象。乱穿马路。jsonpath。spi。json。JsonSmar

  • 我使用来快速访问和修改节点。 模式的示例是:帮助管理位于内部的节点级别上的数据。json的示例是: 我面临类似json的问题: 我需要帮助来构造节点名包含句号的路径。 我尝试了以下示例,但它们对我不起作用: 你知道如何用包含的json节点构造路径吗?

  • 本文向大家介绍linux shell 路径截取正则表达式,包括了linux shell 路径截取正则表达式的使用技巧和注意事项,需要的朋友参考一下 最近写脚本,需要对脚本中函数传递的路径参数进行截取,发现了以下比较好用的方法,记录下: file=/dir1/dir2/dir3/my.file.txt 我们可以用${ }分别替换获得不同的值: ${file#*/}:拿掉第一条/及其左边的字串:dir