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

$..* does not return array elements as expected #164

Open
gerrycampion opened this issue Jan 25, 2024 · 0 comments
Open

$..* does not return array elements as expected #164

gerrycampion opened this issue Jan 25, 2024 · 0 comments

Comments

@gerrycampion
Copy link

The following code:

from jsonpath_ng import parse
jsonpath_expr = parse('$..*')
[f"{match.path}" for match in jsonpath_expr.find({"list":[{"prop1":"val1"},{"prop2":"val2"}]})]

returns a list with 3 items:

['list', 'prop1', 'prop2']

I would expect it to return 5 items something like:

['list', '[0]', 'prop1', '[1]', 'prop2']

It is returning the array, and the values within the properties within objects within the array, but not the objects themselves.

The specification article says "all Elements in XML document. All members of JSON structure."

Other implementations return 5 items as well.

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