# What changed in serde_with

> 38 changes in serde_with 2 to 3 from its official release notes, upgrade guides and advisories: 15 breaking, 3 security, 9 new APIs and options. Each one cited. Sources checked 2026-11-20. HTML: https://unstale.sh/cargo/serde_with/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## serde_with 3

### Breaking changes

- The minimum supported Rust version is bumped to 1.88 due to the darling dependency. (3.18.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v3.18.0)
- The minimum supported Rust version is now 1.82 because yaml_serde requires it as a dev-dependency. (3.17.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v3.17.0)
- Support for custom character sets used for base64 was removed; predefined character sets remain available. (3.0.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v3.0.0)

### Security

- 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.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v3.22.0)
- Limits allocation size during collection creation, preventing bad or attacker-controlled values from causing a panic. (3.21.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v3.21.0)
- serde_with: KeyValueMap serialization panics on empty sequence or map entries (3.21.0) — [security advisory](https://github.com/advisories/GHSA-7GCF-G7XR-8HXJ)

### New APIs and options

- The new feature flag enables support for jiff v0.2, including the listed jiff types with DurationSeconds and TimestampSeconds adapters. (3.22.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v3.22.0)
- Adds an adapter that maps `Option<NonZero*>` to a plain integer, encoding `None` as `0`. (3.21.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v3.21.0)
- Adds support for base58 encoding, similar to the existing base64 setup. (3.20.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v3.20.0)
- Extends base64 with schemars support. (3.20.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v3.20.0)
- Adds support for hashbrown v0.17, extending the existing version support. (3.19.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v3.19.0)
- Adds a JsonSchemaAs implementation for json::JsonString. (3.16.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v3.16.0)
- Adds support for smallvec v1 when the smallvec_1 feature flag is enabled. (3.16.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v3.16.0)

### Behavior and default changes

- with_prefix! is now available with the alloc feature instead of requiring std. (3.24.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v3.24.0)
- with_suffix! is now available with the alloc feature instead of requiring std. (3.24.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v3.24.0)
- OneOrMany now supports more sequence and set types. (3.18.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v3.18.0)

### Fixes and other changes

- Deserialization of chrono and time DateTimes now handles potential panics. (3.24.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v3.24.0)
- Fields using NoneAsEmptyString now compile with the schemars_* features through a JsonSchemaAs implementation. (3.24.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v3.24.0)
- serde_as can now parse cfg_attr attributes with true or false conditions, including when emitting schemars annotations. (3.23.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v3.23.0)
- OneOrMany now supports smallvec v1. (3.17.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v3.17.0)
- Fixed JsonSchemaAs for SetPreventDuplicates and SetLastValueWins. (3.16.1) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v3.16.1)

## serde_with 2

### Breaking changes

- The module-based conversion is removed; use BytesOrString in serde_as instead. (2.0.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v2.0.0)
- The module-based conversion is removed; use DefaultOnError in serde_as instead. (2.0.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v2.0.0)
- The module-based conversion is removed; use DefaultOnNull in serde_as instead. (2.0.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v2.0.0)
- The module-based conversion is removed; use DisplayFromStr in serde_as instead. (2.0.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v2.0.0)
- The Separator trait and its implementations have moved to the formats module. (2.0.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v2.0.0)
- The module-based conversion is removed; use json::JsonString in serde_as instead. (2.0.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v2.0.0)
- The minimum supported Rust version is now 1.60, required for the optional dependency feature syntax in cargo. (2.0.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v2.0.0)
- The module-based conversion is removed; use DisplayFromStr with the container type in serde_as. (2.0.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v2.0.0)
- The previously deprecated module is removed. (2.0.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v2.0.0)
- The old module conversion is removed; use NoneAsEmptyString with serde_as instead. (2.0.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v2.0.0)
- StringWithSeparator can now only be used in serde_as. (2.0.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v2.0.0)
- The module-based conversion is removed; use BTreeMap or HashMap in serde_as on a Vec of tuples. (2.0.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v2.0.0)

### New APIs and options

- JsonString can now nest serde_as definitions, allowing custom serialization logic before a value is converted into a JSON string. (2.0.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v2.0.0)
- Use no_default to suppress the automatic serde(default) behavior for matching Option fields. (2.0.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v2.0.0)

### Behavior and default changes

- The serialization bound changes from AsRef<str> to a different bound, making serialization less limiting for non-string types like Option<i32>. (2.0.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v2.0.0)
- Its serialization bound changes from AsRef<str> to a different bound, making serialization less limiting for non-string types like Option<i32>. (2.0.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v2.0.0)

### Fixes and other changes

- 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.0) — [release notes](https://github.com/jonasbb/serde_with/releases/tag/v2.0.0)
