dtolnay / path-to-error

Find out path at which a deserialization error occurred
Apache License 2.0
320 stars 12 forks source link

Reporting the content of the key that doesn't match (untagged enum) #31

Open gheorghitamutu opened 2 months ago

gheorghitamutu commented 2 months ago

Hello, I'm parsing various data structures from JSONs an currently I'm getting an error that looks like this:

Error deserializing StructureX JSON: Error { path: Path { segments: [Map { key: "key1" }, Map { key: "key2" }, Map { key: "key3" }, Seq { index: 0 }, Map { key: "key4" }, Map { key: "key5" }, Map { key: "key6" }, Seq { index: 1 }, Map { key: "key7" }] }, original: Error("data did not match any variant of untagged enum EnumYFromStructureX", line: 0, column: 0) } for some specific case!

What I'd be interested in if I can get reported back the content of the key that did not match the enum - in any form (bytes/UTF-8 string/etc).