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
This is similar, but not quite the same as #497. In this case it is a normally tagged enum.
Rust playground example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=4d9015b013535f143aa5b8ad829be43c
Code:
use serde_json::value::RawValue; use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize)] pub struct RequestBody { pub payload: Box<RawValue>, } #[derive(Serialize, Deserialize)] #[serde(tag = "type")] enum Incoming { Request { payload: Box<RawValue>, }, } fn main() { let foo = Incoming::Request { payload: serde_json::value::to_raw_value(&42).unwrap() }; let txt = serde_json::to_string(&foo).unwrap(); let roundtrip: Incoming = serde_json::from_str(&txt).unwrap(); }
The text was updated successfully, but these errors were encountered:
Box<RawValue>
#[serde(flatten)]
No branches or pull requests
This is similar, but not quite the same as #497. In this case it is a normally tagged enum.
Rust playground example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=4d9015b013535f143aa5b8ad829be43c
Code:
The text was updated successfully, but these errors were encountered: