`#[serde(skip_serializing_if="...")]` can replace this functionality.
#[serde(deserialize_with="...")]