gpt4 book ai didi

java - JsonPath:按数组中任意数组中的值进行过滤

转载 作者:太空宇宙 更新时间:2023-11-04 09:35:43 25 4
gpt4 key购买 nike

我尝试过滤以从具有扩展信息[SOURCE_OR_TARGET==“TARGET”]的“*..ou.subscriber”内的subscriberNumber获取值,但我的jsonpath不起作用。

我尝试的 jsonpath:

$..ou[?(@.extendedInfo[0].value=="TARGET")].subscriber[0].subscriberNumber

结果,我要得到这个subscriberNumber = "001"

JSON:

    {
"customer": {
"customerId": "34975213",
"ou": [
{
"numberOfIDD": 0,
"numberOfIR": 0,
"ouId": 117482315,
"subscriber": [
{
"status": 0,
"subscriberId": "90674393",
"subscriberNumber": "001"
}
],
"responseCode": "FM120100000",
"responseMsg": "Success",
"extendedInfo": [
{
"name": "SOURCE_OR_TARGET",
"value": "BUCKET"
},
{
"name": "SOURCE_OR_TARGET",
"value": "TARGET"
}
]
},
{
"numberOfIDD": 0,
"numberOfIR": 0,
"ouId": 21046276,
"subscriber": [
{
"status": 65,
"subscriberId": "17404432",
"subscriberNumber": "002"
}
],
"extendedInfo": [
{
"name": "SOURCE_OR_TARGET",
"value": "SOURCE"
}
]
}
]
}
}

感谢您的帮助。

最佳答案

糟糕的设计数据结构,您希望使用扩展信息过滤订阅者节点,但不将其包含在订阅者中

关于java - JsonPath:按数组中任意数组中的值进行过滤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56553380/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com