json-rust icon indicating copy to clipboard operation
json-rust copied to clipboard

Add as_object() and as_array() methods

Open sivadeilra opened this issue 4 years ago • 2 comments

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.

sivadeilra avatar Jan 24 '21 19:01 sivadeilra

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

milesj avatar Jan 10 '22 00:01 milesj

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

gierens avatar Aug 25 '23 17:08 gierens