serde-json-core icon indicating copy to clipboard operation
serde-json-core copied to clipboard

deserialize_str with escaped strings is broken

Open jordens opened this issue 2 years ago • 13 comments
trafficstars

serde_json_core needs to refuse deserializing a borrowed string with escape sequences.

serde_json_core::from_slice::<&str>(br#""\n""#) incorrectly gives Ok(("\\n", 4)).

serde_json::from_slice::<&str>(br#""\n""#) correctly says Error("invalid type: string \"\\n\", expected a borrowed string", line: 1, column: 4).

jordens avatar Aug 22 '23 07:08 jordens