We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
serde = { version = "^1.0.204", features = ["derive"] } serde_json = { version = "^1.0.120", features = ["arbitrary_precision"] }
Code:
#[derive(Serialize, Deserialize)] struct MainStruct { #[serde(flatten)] key_value_pairs: HashMap<String, f64>, } let obj = MainStruct { key_value_pairs: [("key".to_string(), 1.0f64)].into_iter().collect(), }; let serialized = serde_json::to_string(&obj).unwrap(); println!("{:?}", serialized); let _parsed: MainStruct = serde_json::from_str(&serialized).unwrap();
This prints the correctly serialized string
{"key":1.0}
But when it tries to deserialize it again, it panics with:
called `Result::unwrap()` on an `Err` value: Error("invalid type: map, expected f64", line: 1, column: 11)
The text was updated successfully, but these errors were encountered:
This seems to be a variation of #959.
Sorry, something went wrong.
No branches or pull requests
serde = { version = "^1.0.204", features = ["derive"] }
serde_json = { version = "^1.0.120", features = ["arbitrary_precision"] }
Code:
This prints the correctly serialized string
But when it tries to deserialize it again, it panics with:
The text was updated successfully, but these errors were encountered: