Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expression with wildcard then index selection errors with KeyError #93

Open
chutcher01 opened this issue Nov 17, 2021 · 0 comments
Open

Comments

@chutcher01
Copy link

chutcher01 commented Nov 17, 2021

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:

  • The expression without the wildcard does not raise this exception. e.g. $.a[0].b
  • If you remove key "c" then the exception is not raised
  • This expression is working in NodeJS, iOS, and Android libraries I have tested
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant