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

JsonValue::push() should not return Result

Open njaard opened this issue 7 years ago • 0 comments

push() returns a Result so that if you try to push onto something that's not an array. I think this function should return nothing and panic (or just do nothing) on a failure. Or maybe it can return &JsonValue to the newly created value.

For most almost everyone, this can't possibly fail because they already know they're operating on an array. Now I have to unwrap or handle an impossible error or I get a meaningless warning (like the very examples in the documentation).

For example, entries and members fail silently.

njaard avatar Feb 19 '18 16:02 njaard