pub fn deserialize_empty_string_as_none<'de, D>(
deserializer: D,
) -> Result<Option<String>, D::Error>where
D: Deserializer<'de>,Expand description
Deserializes an empty string into None.
Many exchange APIs represent null string fields as an empty string ("").
When such a payload is mapped onto Option<String> the default behavior
would yield Some(""), which is semantically different from the intended
absence of a value. This helper ensures that empty strings are normalized
to None during deserialization.
ยงErrors
Returns an error if the JSON value cannot be deserialized into a string.