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
I want to serialize a Option<String> to unflatten self close element like <Foo><option-with-none-value/></Foo>. Is there any way to control it?
Option<String>
<Foo><option-with-none-value/></Foo>
Code:
#[derive(Debug, Deserialize, Serialize, PartialEq)] pub struct Foo { #[serde(rename = "$unflatten=option-with-none-value")] pub body: Option<String>, } to_string(&Foo { body: None }).unwrap()
Result:
<Foo><option-with-none-value></option-with-none-value></Foo>
The text was updated successfully, but these errors were encountered:
In current master this is how it works out-of-box since #490 is merged:
#[derive(Debug, Deserialize, Serialize, PartialEq)] pub struct Foo { #[serde(rename = "option-with-none-value")] pub body: Option<String>, } assert_eq!( to_string(&Foo { body: None }).unwrap(), "<Foo><option-with-none-value/></Foo>" );
But deserialization of that value will return Some("") for now due to #497.
Some("")
Sorry, something went wrong.
No branches or pull requests
I want to serialize a
Option<String>
to unflatten self close element like<Foo><option-with-none-value/></Foo>
. Is there any way to control it?Code:
Result:
The text was updated successfully, but these errors were encountered: