h2non / jsonpath-ng

Finally, a JSONPath implementation for Python that aims to be standard compliant. That's all. Enjoy!
Apache License 2.0
572 stars 85 forks source link

Expression with wildcard then index selection errors with KeyError #93

Open chutcher01 opened 2 years ago

chutcher01 commented 2 years ago

Steps to Reproduce:

from jsonpath_ng import parse

something = {
    "a": [
        {
            "b": "found value"
        },
    ],
    "c": {
        "d": "another value"
    }
}

# This expression will error
expression = parse("$.*[0].b")

# This one will work
# expression = parse("$.a[0].b")

# exception raised on find
found = expression.find(something)

print(found[0].value)

Observations: