h2non / jsonpath-ng

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

Filter leaves, and return leaves, not parent of leaf #58

Open deliciouslytyped opened 3 years ago

deliciouslytyped commented 3 years ago

I can use the expression $..*[?(@[*] = "\r\n")] to for example search for any instances of the exact string "\r\n" in a tree structure. This works but it returns the "parents" of the leaf "\r\n" nodes, i.e. the dict or list containing the string.

Is there any way to get the strings/leaves themselves as results? This isn't useful for the case where you're matching an exact string, but would be useful for regexes for example.

deliciouslytyped commented 3 years ago

see https://github.com/h2non/jsonpath-ng/issues/59#issuecomment-703314120