unstale

cargo / serde_with

serde_with

What changed in serde_with 2 to 3, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-20.

15 breaking3 security9 new APIs and options5 behavior and defaults6 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

serde_with 321 changes

Breaking changes 3

  • The minimum supported Rust version is bumped to 1.88 due to the darling dependency.

    3.18.0release notes

  • The minimum supported Rust version is now 1.82 because yaml_serde requires it as a dev-dependency.

    3.17.0release notes

  • Support for custom character sets used for base64 was removed; predefined character sets remain available.

    3.0.0release notes

Security 3

  • These collections now use size_hint_cautious, preventing attacker-controlled huge length hints from causing a capacity-overflow panic before any elements are read.

    3.22.0release notes

  • Limits allocation size during collection creation, preventing bad or attacker-controlled values from causing a panic.

    3.21.0release notes

  • serde_with: KeyValueMap serialization panics on empty sequence or map entries

    3.21.0security advisory

New APIs and options 7

  • The new feature flag enables support for jiff v0.2, including the listed jiff types with DurationSeconds and TimestampSeconds adapters.

    3.22.0release notes

  • Adds an adapter that maps Option<NonZero*> to a plain integer, encoding None as 0.

    3.21.0release notes

  • Adds support for base58 encoding, similar to the existing base64 setup.

    3.20.0release notes

  • Extends base64 with schemars support.

    3.20.0release notes

  • Adds support for hashbrown v0.17, extending the existing version support.

    3.19.0release notes

  • Adds a JsonSchemaAs implementation for json::JsonString.

    3.16.0release notes

  • Adds support for smallvec v1 when the smallvec_1 feature flag is enabled.

    3.16.0release notes

Behavior and default changes 3

  • with_prefix! is now available with the alloc feature instead of requiring std.

    3.24.0release notes

  • with_suffix! is now available with the alloc feature instead of requiring std.

    3.24.0release notes

  • OneOrMany now supports more sequence and set types.

    3.18.0release notes

Fixes and other changes 5

  • Deserialization of chrono and time DateTimes now handles potential panics.

    3.24.0release notes

  • Fields using NoneAsEmptyString now compile with the schemars_* features through a JsonSchemaAs implementation.

    3.24.0release notes

  • serde_as can now parse cfg_attr attributes with true or false conditions, including when emitting schemars annotations.

    3.23.0release notes

  • OneOrMany now supports smallvec v1.

    3.17.0release notes

  • Fixed JsonSchemaAs for SetPreventDuplicates and SetLastValueWins.

    3.16.1release notes

serde_with 217 changes

Breaking changes 12

  • The module-based conversion is removed; use BytesOrString in serde_as instead.

    2.0.0release notes

  • The module-based conversion is removed; use DefaultOnError in serde_as instead.

    2.0.0release notes

  • The module-based conversion is removed; use DefaultOnNull in serde_as instead.

    2.0.0release notes

  • The module-based conversion is removed; use DisplayFromStr in serde_as instead.

    2.0.0release notes

  • The Separator trait and its implementations have moved to the formats module.

    2.0.0release notes

  • The module-based conversion is removed; use json::JsonString in serde_as instead.

    2.0.0release notes

  • The minimum supported Rust version is now 1.60, required for the optional dependency feature syntax in cargo.

    2.0.0release notes

  • The module-based conversion is removed; use DisplayFromStr with the container type in serde_as.

    2.0.0release notes

  • The previously deprecated module is removed.

    2.0.0release notes

  • The old module conversion is removed; use NoneAsEmptyString with serde_as instead.

    2.0.0release notes

  • StringWithSeparator can now only be used in serde_as.

    2.0.0release notes

  • The module-based conversion is removed; use BTreeMap or HashMap in serde_as on a Vec of tuples.

    2.0.0release notes

New APIs and options 2

  • JsonString can now nest serde_as definitions, allowing custom serialization logic before a value is converted into a JSON string.

    2.0.0release notes

  • Use no_default to suppress the automatic serde(default) behavior for matching Option fields.

    2.0.0release notes

Behavior and default changes 2

  • The serialization bound changes from AsRef<str> to a different bound, making serialization less limiting for non-string types like Option<i32>.

    2.0.0release notes

  • Its serialization bound changes from AsRef<str> to a different bound, making serialization less limiting for non-string types like Option<i32>.

    2.0.0release notes

Fixes and other changes 1

  • On an Option<T> field using Option<S>, the macro now applies serde(default) unless a default attribute is already present, allowing deserialization when the field is missing.

    2.0.0release notes