jsonpath icon indicating copy to clipboard operation
jsonpath copied to clipboard

Feature/parent operator

Open mattmart3 opened this issue 4 years ago • 2 comments

This PR is to introduce the parent operator '^' (issue #80). The implementation is quite simple: it uses a HashMap to store the parent nodes of every visited Value in the tree. When the parent token is later evaluated, all the parent nodes of the current result vector are retrieved. An alternative approach could have been to introduce a new struct (e.g. struct Node) composed of the Value element reference and its parent node reference. Whilst this latter approach would likely have been performed better it would have been way more destructive for the current code base.

I hope you can find this useful and consider I am Rust beginner, so feel free to make any suggestion in order to improve the PR.

mattmart3 avatar Nov 22 '21 22:11 mattmart3

This issue is about to be added to the additional feature. (Note #75) I'm cleaning up the related code. wait please. :)

freestrings avatar Dec 01 '21 02:12 freestrings

Thank you for the feedback @freestrings. If I understand correctly you are considering to enable this feature based on a setting parameter, right? Anyway I've just updated this PR with a fix on the parser, some more tests and a minor improvement for the hasmap use.

mattmart3 avatar Dec 01 '21 06:12 mattmart3