简体   繁体   中英

JsonPath: filter by value in any array in array

I try to filter to get value from subscriberNumber inside "*..ou.subscriber" that have extendedinfo[SOURCE_OR_TARGET=="TARGET"], but my jsonpath its doesn't work.

The jsonpath I try:

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

The result, I would like to get this subscriberNumber = "001"

The 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"
                    }
                ]
            }
        ]
    }
}

Thank you for your help.

您想要为带有扩展信息的订户节点过滤但不将其包括在订户中的不良设计数据结构

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM