You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Probably serde_json should not call visit_seq if deserialize_map / deserialize_struct was requested by the type. Then deserialization structs from JSON arrays would be impossible. That also can be a configurable behavior of serde_json deserializer.
I don't see how this is a duplicate, @oli-obk. This is about documenting behavior of serde_json, not about changing it. The other issue asks for behavioral changes that are likely backward incompatible and thus unlikely to happen.
Last time I saw this was https://old.reddit.com/r/rust/comments/1332t9b/ji7oo8m/, but I've also seen it earlier and found it surprising both times.
Basically both
{"hello": "test", "value": 42}
(expected) and["test", 42]
deserialize perfectly fine into the following struct:Since this is not mentioned anywhere, this can accidentally become a used API when serde is used to parse JSON (Hyrum's law).
It would be nice if this could be featured somewhere prominently in the docs. I couldn't actually find it there, even looking for it.
The text was updated successfully, but these errors were encountered: