tidwall / gjson.rs

Get JSON values quickly - JSON parser for Rust
MIT License
216 stars 12 forks source link

Raw index #9

Closed dselans closed 1 year ago

dselans commented 1 year ago

Hi @tidwall - thank you for both the Go and Rust version of this library - they're great!

I have a need to modify JSON at a specific path and was going to give it a try using gjson however it does not seem to have an index() func unlike in Golang to determine the byte location for the found value.

Before I dive into the gjson implementation for Rust, maybe you could advise on what you think might be a decent approach to setting arbitrary JSON in Rust? Or maybe it's just a case of a simple update to gjson to expose an index() func?

TIA

dselans commented 1 year ago

Please disregard - I should've looked at the source before opening the issue :)

Value struct has a private index on it that is an Option<usize> - I've exposed this in my fork and am able to accomplish what I needed. Thank you!