I am using serde for a project and I would like to deserialize an object like the following:
#[derive(Deserialize, Clone, Debug)]
pub struct ParentObject {
unique_id: String,
super_complicated_object: MegaAwesomeObject
}
Since MegaAwesomeObject is very complicated, it will be occasionally prone to errors in case the payload is provided incorrectly. If that does occur, I do not want to error out on the ParentObject deserialization as well, since I do not want to lose the record of the unique_id. Is there a way for me to somehow use the default value for MegaAwesomeObject in case the deserialization fails?
Thank you for the help.