maciejhirsz / json-rust

JSON implementation in Rust
Apache License 2.0
563 stars 63 forks source link

Add as_object() and as_array() methods #195

Closed sivadeilra closed 1 month ago

sivadeilra commented 3 years ago

This adds JsonValue::as_object() and JsonValue::as_array() methods. This provides parity with the as_u32, as_str, etc. methods. It simplifies code that deals with objects and arrays directly, rather than using serde for a schematized view.

Also added JsonValue::get() and JsonValue::get_mut(), which forward their calls to Object.

milesj commented 2 years ago

Been almost a year and these methods would be seriously useful.

gierens commented 10 months ago

Since this project is unmaintained, I forked to https://github.com/rustadopt/jzon-rs where I for example merged this PR and maintain it from now on with the community. It's also available in v0.12.5 on https://crates.io/crates/jzon