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
alias
flatten
At least in this example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=c2ee5b544b5b939cf67f364d756f5bea
serde_json::from_str gives error
serde_json::from_str
"missing field calculation_status"
calculation_status
even though calculationStatus is there and we have such an alias.
calculationStatus
If you move the calculation_status field with attributes directly into the Plate struct (and remove PlateFlags), it works.
Plate
PlateFlags
The text was updated successfully, but these errors were encountered:
I can confirm this is an issue.
Example:
use serde_derive::{Deserialize}; #[derive(Deserialize, Debug)] pub struct Config { #[serde(alias = "field1")] pub new_name: Option<String>, pub field2: Option<String>, } #[derive(Deserialize, Debug)] pub struct NestedConfig { #[serde(flatten)] pub common: Config, } fn main() { let raw = "{\"field1\": \"value1\", \"field2\": \"value2\"}"; let config: Config = serde_json::from_str(&raw).unwrap(); println!("{:?}", config); let nested: NestedConfig = serde_json::from_str(&raw).unwrap(); println!("{:?}", nested); }
This results in:
Config { new_name: Some("value1"), field2: Some("value2") } NestedConfig { common: Config { new_name: None, field2: Some("value2") } }
Sorry, something went wrong.
This looks like a duplicate of #1504
Closing as a duplicate of #1504.
No branches or pull requests
At least in this example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=c2ee5b544b5b939cf67f364d756f5bea
serde_json::from_str
gives erroreven though
calculationStatus
is there and we have such an alias.If you move the
calculation_status
field with attributes directly into thePlate
struct (and removePlateFlags
), it works.The text was updated successfully, but these errors were encountered: