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_json version 1.0.108 serde version 1.0.192
serde_json
serde
Deserializing an empty tuple variant of an enum from a Value fails. Deserializing a unit variant succeeds.
Value
#[test] fn test_serde_json() { use serde::{Deserialize, Serialize}; #[derive(Debug, PartialEq, Eq, Deserialize, Serialize)] enum Test { V1, V2(), } for v in [Test::V1, Test::V2()] { println!("testing {v:?}"); let json = serde_json::to_value(&v).unwrap(); println!("serializes to {json}"); assert_eq!(v, serde_json::from_value(json).unwrap()); } }
Outputs:
testing V1 serializes to "V1" testing V2 serializes to {"V2":[]}
And then panics when trying to deserialize V2():
V2()
called `Result::unwrap()` on an `Err` value: Error("invalid type: null, expected tuple variant Test::V2", line: 0, column: 0)
The text was updated successfully, but these errors were encountered:
Change AssembledSignature variant from Genesis() to Genesis
9a0874c
serde_json appears not to handle empty tuple variants correctly, but it does handle unit variants: serde-rs/json#1084
hello, how to resolve the problem?
Sorry, something went wrong.
No branches or pull requests
serde_json
version 1.0.108serde
version 1.0.192Deserializing an empty tuple variant of an enum from a
Value
fails. Deserializing a unit variant succeeds.Outputs:
And then panics when trying to deserialize
V2()
:The text was updated successfully, but these errors were encountered: