Skip to content

Current node regex filter seems to be failing with recursive descent #159

@arcivanov

Description

@arcivanov
        from jsonpath_ng.ext import parse
        from pprint import pprint
        datum = {
            "a": "x",
            "array": [
                {"bcde": "y"}
            ]
        }
        pprint(parse('$..*').find(datum))
        pprint(parse('$..*[?@ =~ "a"]').find(datum))
        pprint(parse('$..*[?@ =~ "b.*"]').find(datum))

Results:

[DatumInContext(value='x', path=Fields('a'), context=DatumInContext(value={'a': 'x', 'array': [{'bcde': 'y'}]}, path=Root(), context=None)),
 DatumInContext(value=[{'bcde': 'y'}], path=Fields('array'), context=DatumInContext(value={'a': 'x', 'array': [{'bcde': 'y'}]}, path=Root(), context=None)),
 DatumInContext(value='y', path=Fields('bcde'), context=DatumInContext(value={'bcde': 'y'}, path=Index(index=0), context=DatumInContext(value=[{'bcde': 'y'}], path=Fields('array'), context=DatumInContext(value={'a': 'x', 'array': [{'bcde': 'y'}]}, path=Root(), context=None))))]
[]
[]

Expected results would include a and array in the second query and bcde in the third.

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