David Tolnay

Results 358 issues of David Tolnay

[RapidJSON does quite a lot of this.](https://github.com/miloyip/rapidjson/blob/369de87e5d7da05786731a712f25ab9b46c4b0ce/include/rapidjson/reader.h#L936-L942)

performance

The behavior of serde_json::from_reader is that it expects the input stream to end after the deserialized object. If the stream contains trailing data, that is considered an error. If the...

docs

```rust pub fn from_mut_str Result where T: Deserialize

performance

There are some great test cases [here](https://github.com/serde-rs/json-benchmark/blob/10b8a2d834fab489a67b3beb478418040daf711b/src/main.rs#L226) (not all of which we pass).

tests

An `IntoDeserializer` impl would provide a way to deserialize from these types while constructing exactly the right error type on failure, rather than constructing a `serde_json::Error` and mapping it to...

enhancement

[This page](https://docs.serde.rs/serde_json/fn.from_value.html) should additionally show an example of deserializing from &Value. ```rust let u = User::deserialize(&j)?; ```

docs

https://github.com/SergioBenitez/Rocket/pull/547 wants to do the following two steps but get a single serde_json::Error out, rather than an io::Error and a serde_json::Error. ```rust let mut s = String::new(); data.read_to_string(&mut s)?; let...

enhancement

https://github.com/brson/rust-api-guidelines#c-question-mark

docs

I would like an infallible JSON value conversion crate. Basically [`rustc_serialize::json::ToJson`](https://docs.rs/rustc-serialize/0.3.24/rustc_serialize/json/trait.ToJson.html) but for `serde_json::Value`. With `serde_json::to_value` you get a fallible conversion that may fail for example because the input is...

enhancement

[`to_value`](https://docs.serde.rs/serde_json/fn.to_value.html) has both. The others are not as good. The Errors sections should contain an example of code that triggers the error. Especially for to_* these are not always obvious.

docs