Closed grindvoll closed 9 months ago
Thank you @grindvoll for reporting and investigating this issue! This sounds like an easy-enough change to me. Would you like to file a PR yourself that also adds a test with your usecase? I'm unfortunately quite swamped with uni at the moment.
Ok, I will try to file a PR with unit test as soon as possible.
I just encountered this somewhat strange behavior. Trying to deserialize a very simple RON string into a
serde_json::Value
fails with anExpectedIdentifier
error:I know that RON is not meant to be a self describing format and supports more types than JSON, but I expected this simple structure to be deserialized correctly; the identifiers should support deserializing to string keys.
The trigger of the error is that the
serde_json::Value
type expect ownedString
keys. After some investigating, it seems that the problem is related to theid::Deserializer
variant, which supportsdeserialize_str(..)
, but NOTdeserialize_string(..)
, which I find somewhat inconsistent. These methods should give the same result; the reason for having two methods is to give hints about expected string ownership (for performance reasons).The following patch in
de/id.rs
file makes the code example work as expected: