Is there a way to extract the missing field name from serde_json::Error?

Viewed 785

serde_json returns a serde_json::Error when deserializing a field missing from the JSON but not optional in the struct. That error can be converted into a string and that string has the missing field name, generally of the form: Error("missing field 'b'", line: 1, column: 9).

Short of parsing it out of that string, I cannot figure out how to extract the missing field name. Is string parsing really my only option?

0 Answers
Related