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
With a simple enum type like this one:
#[derive(Debug, Deserialize)] enum Foo { Bar, Baz, }
If the json passed does not have the correct type, the error message is confusing. For example:
let bool_foo = serde_json::from_str::<Foo>("true"); println!("Bool foo: {:?}", bool_foo); // This prints: Bool foo: Err(Error("expected value", line: 1, column: 1))
I would expect the error message to tell that the type is a boolean instead of the expected string.
See the following playground to reproduce together with a custom Deserialize implementation which behave more like I would expect: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=be6d3c0aa282ae7ee1bf5d9748709f4b
The text was updated successfully, but these errors were encountered:
No branches or pull requests
With a simple enum type like this one:
If the json passed does not have the correct type, the error message is confusing. For example:
I would expect the error message to tell that the type is a boolean instead of the expected string.
See the following playground to reproduce together with a custom Deserialize implementation which behave more like I would expect: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=be6d3c0aa282ae7ee1bf5d9748709f4b
The text was updated successfully, but these errors were encountered: