jsonpath-rs
jsonpath-rs copied to clipboard
Question: Find and Replace/Delete
Thanks for this crate. What is the best way to implement update/remove once an element is found without retraversing the json?
Hey) Thank you for taking a look at the crate. At the moment it is not possible. Currently it's implemented with recursion, but it has the downsides:
- It's possible to cause stackoverflow, when very big nested json is given
- It requires to traverse all json...
Instead am rewriting it to use iteractor approach. It seems to be harder to implement, but will be much nicer and safer for the end users. You may see some stuff in json-tree-stack-traversal branch now.
I think to address your issue the iterator would need to produce mutable references to json values. At this point it's not implemented yet.
I'll keep the ticket open and I'll write an update if I have some news regarding the topic.
👍 Thanks. For now, I am using https://github.com/danielaparker/jsoncons/blob/master/examples/src/jsonpath_examples.cpp but would love to have Rust based implementation.