Open hweom opened 5 years ago
I've hit this issue as well. @hweom did you find a work around?
Reading https://github.com/serde-rs/json/issues/1051 I understand why flatten
won't work with RawValue
, but I can't find a reason why enum tagging would interfere. Given the example in the original post, I would expect Struct::value
to contain 123
, which is directly located in the input JSON.
It's been a while... I think I ended up not using this particular structuring.
I ran into the same issue (version 1.0.125)
So what would be the solution for this kind of problem? First deserialise just the tag and based on the tag deserialise again?
This code
compiles and runs, but serde_json returns an error:
invalid type: newtype struct, expected any valid JSON value
Playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=84bc58188c5625ce5bbabd6a44da205a