Skip to content

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

@gerrycampion

Description

@gerrycampion

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions