You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Contrary to recommendations of the spec, the Unicode code points U+2028 and U+2029 are not escaped upon serialization. See Section 5.2 of the specification.
Deserialization fails when an input string contains Unicode code points U+2028 or U+2029.
Tested Versions
json5 = "0.2.7"
serde = { version = "1.0.106", features = ["derive"] }
Testcase
#[cfg(test)]
mod tests {
use serde::{Serialize, Deserialize};
use json5;
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
struct S {
value: String
}
#[test]
fn roundtrip_u2028() {
let original = S {
value: "\u{2028}".to_string()
};
let serialized = json5::to_string(&original).unwrap();
let deserialized = json5::from_str::<S>(&serialized).unwrap();
assert_eq!(deserialized, original);
}
}
The text was updated successfully, but these errors were encountered:
Any update on this one still failing? I just got bitten with parsing a remote JSON file which includes "\u{2028}". I've fixed it by replacing it before passing it to json5.
Description
Tested Versions
Testcase
The text was updated successfully, but these errors were encountered: