Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Find and Replace/Delete #1

Open
rohitjoshi opened this issue Jan 22, 2018 · 2 comments
Open

Question: Find and Replace/Delete #1

rohitjoshi opened this issue Jan 22, 2018 · 2 comments

Comments

@rohitjoshi
Copy link

Thanks for this crate. What is the best way to implement update/remove once an element is found without retraversing the json?

@rohitjoshi rohitjoshi changed the title Question: Find and update Question: Find and Replace/Delete Jan 22, 2018
@greyblake
Copy link
Owner

greyblake commented Jan 23, 2018

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.

@rohitjoshi
Copy link
Author

👍 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants