JSONPath 过滤器不适用于包含嵌套对象而不是数组的嵌套 json

JSONPath filter not working on nested json that contains nested object instead of an array

我正在寻找一种方法来过滤此 JSON 并仅在 fid > 10

时检索成本

工作示例,parent 属性是一个数组:

 [
    {
        "id": 1,
        "properties": {
            "parent": [
                {
                    "fid": 10,
                    "cost": 100
                }
            ]
        }
    },
    {
        "id": 2,
        "properties": {
            "parent": [
                {
                    "fid": 20,
                    "cost": 200
                }
            ]
        }
    },
    {
        "id": 32,
        "properties": {
            "parent": [
                {
                    "fid": 30,
                    "cost": 300
                }
            ]
        }
    }
]

JSON路径=$[*].properties.parent[?(@['fid']>10)].cost

result = [
  200,
  300
]

无效示例,parent 道具现在是一个对象:

[
    {
        "id": 1,
        "properties": {
            "parent": {
                "fid": 10,
                "cost": 100
            }
        }
    },
    {
        "id": 2,
        "properties": {
            "parent": {
                "fid": 20,
                "cost": 200
            }
        }
    },
    {
        "id": 32,
        "properties": {
            "parent": {
                "fid": 30,
                "cost": 300
            }
        }
    }
]

JSON路径=$[*].properties.parent[?(@['fid']>10)].cost

结果是No match

试试这个

$[?(@.properties.parent.fid>10)].properties.parent.cost