json
json copied to clipboard
Untagged enum containing a subtype fails to deserialize, whilst the subtype itself can directly deserialize
Playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=9e3bd4da5ac247254d3017e839bd5f39
I have a struct that contains a HashMap<u32, String>.
This type correctly deserializes when using serde_json::from_str() with a json string such as {"data":{"1":"test"}}.
Yet when I put this type into an untagged enum variant, it does not work anymore. If I then change the key type from u32 to String, it compiles.
This does not seem like intended behaviour, otherwise the variant itself should also fail, see the playground for a better example.
Might be related to: https://github.com/serde-rs/json/issues/1254 https://github.com/serde-rs/json/issues/1244