NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io, #19 most downloaded on crates.io
A generic serialization/deserialization framework
Latest stable
1.0.229
Last release 4 months ago
18 Jul 2026
Ships unpredictably
gaps range from 2 weeks to 10 months
Nearly every release is documented
notes for 56 of the last 60 stable releases
3 versions withdrawn
withdrawn after publishing
12 years old
316 releases · first in 2014
Drag across the ruler to compare, or tap a release to open it.
Remove Serialize and Deserialize impls for collections::enum_set::EnumSet which has been deprecated for a long time
Remove clippy dependency to unblock the documentation build in docs.rs
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Provide `serde::Impossible, a helper for Serializer implementations that do not support serializing one of the compound types
serde::ser::Impossible, a helper for Serializer implementations that do not support serializing one of the compound types (#694)Fix invalid-length error message for arrays and tuple that incorrectly claimed the length was always 0
Add `SerializeMap::serialize_entry` to allow serializers to optimize for the case where key and value are both available at the same time
SerializeMap::serialize_entry to allow serializers to optimize for the case where key and value are both available at the same time (#724)Bump the serde dev-dependency on serde_derive - see this forum thread
serde dev-dependency on serde_derive - see this forum threadThere are no silent breaking changes in this release. As you work to update your libraries, the compiler will tell you everything that needs to be cha…
In the six months since Serde 0.8.0 we have learned a lot about how people use Serde, how people wish they could use Serde, and the common failure modes when people try to use Serde.
The primary focus of 0.9.0 is on using Rust's type system to enforce contracts that were implicit and fragile in previous Serde versions. All four of the Serialize, Deserialize, Serializer, and Deserializer traits have been redesigned to use ownership as a way to enforce that implementations are correct.
Another exciting improvement is a redesigned error-reporting API that produces substantially more helpful error messages. The new API supports no_std as a first-class citizen, meaning no_std users are now able to receive the same helpful messages as std. Speaking of no_std, #[derive(Serialize, Deserialize)] now works within no_std crates.
Serde 0.9.0 is a huge release compared to previous ones. Thank you to dozens of people who have contributed improvements, opened issues, provided help to others, or expressed their frustrations with Serde in a constructive way. We appreciate your continued support as we pin down what a 1.0.0 data structure serialization library for Rust should look like.
This release includes serde_codegen for Rust 1.14 and earlier users. With Macros 1.1 custom derives being stabilized next week in Rust 1.15, we will not be releasing any further 0.9.x versions of serde_codegen. Please migrate to serde_derive at your convenience. See the manual for steps.
There are no silent breaking changes in this release. As you work to update your libraries, the compiler will tell you everything that needs to be changed.
Users of serde_json should read also the serde_json 0.9.0 release notes. This is a great release for serde_json, including a powerful new json! macro.
The signature of Serialize::serialize has changed.
- fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error>
- where S: Serializer;
+ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
+ where S: Serializer;
Together with the Serializer changes in this release, the new signature enforces that the implementation makes exactly one serializer method call. In previous Serde versions, an incorrect Serialize implementation could invoke the serializer not at all or more than once, resulting in a correctly-written serializer producing syntactically invalid output.
The signature of Deserialize::deserialize has changed.
- fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
- where D: Deserializer;
+ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
+ where D: Deserializer;
Same reason as the Serialize change.
The Serializer comes with an associated type S::Ok.
All Serializer methods return this type and it is propagated by the Serialize trait as you can see above. The various Serializer methods have changed like this:
- fn serialize_bool(&mut self, v: bool) -> Result<(), Self::Error>;
+ fn serialize_bool(self, v: bool) -> Result<Self::Ok, Self::Error>;
The change from &mut self to self is how the Serialize trait enforces at most one call to a serializer method, and the associated type S::Ok is how the Serialize trait enforces at least one call to a serializer method. Together these changes enforce a correct Serialize implementation.
Most serializers that produce binary or text data as output or write to a stream will want to set Ok = (). In some cases serializers that build in-memory data structures as output may benefit from using a different Ok type. For example serde_json provides a Serializer that turns a type T into serde_json::Value (this is distinct from the main serde_json Serializer that produces JSON text). This Serializer is vastly simplified by using Ok = serde_json::Value compared to its previous implementation.
The change from &mut self to self means that many Serializers will want to change their implementation from impl Serializer for SomeThing to impl<'a> Serializer for &'a mut SomeThing.
The serialization scheme for compound types has changed.
This does not affect types that use #[derive(Serialize)]. It affects types that provide custom implementations of Serialize and serialize into one of the compound types: sequence, tuple, tuple struct, tuple variant, map, struct, or struct variant.
For example to serialize a sequence type like Vec<T>:
- let mut seq_state = serializer.serialize_seq(Some(self.len()))?;
- for element in self {
- serializer.serialize_seq_elt(&mut seq_state, element)?;
- }
- serializer.serialize_seq_end(seq_state)
+ let mut seq = serializer.serialize_seq(Some(self.len()))?;
+ for element in self {
+ seq.serialize_element(element)?;
+ }
+ seq.end()
The new scheme is more concise and uses ownership to enforce a correct implementation. It is impossible to forget to call end() because you cannot get an S::Ok instance otherwise. Previously, forgetting to call serialize_seq_end would often result in broken output from the serializer.
The pointer-sized usize and isize types are no longer part of the Serde data model.
Rust's usize and isize types are still supported but will be serialized as u64 and i64 from the perspective of a Serializer and Deserializer implementation.
The ser::Error and de::Error traits have been redesigned.
The new design is able to produce substantially more helpful error messages and supports no_std as a first-class citizen without sacrificing usability for std users.
- Invalid type. Expected `I64`
+ invalid type: integer `99`, expected a string
- Unknown variant `X`
+ unknown variant `X`, expected one of `A`, `B`, `C`
- Invalid length: 1
+ invalid length 1, expected a tuple of 2 elements
Please see the API documentation for details.
A new stateful deserialization API.
A DeserializeSeed trait has been added to handle cases where deserialization needs to depend on some pre-existing piece of state (the "seed"). One possible application of this API is for deserialization that writes into an existing previously allocated buffer rather than allocating a fresh buffer for every element. The existing buffer can be used as a "seed" that the DeserializeSeed implementation can write into.
This API dramatically simplifies serde-transcode and other streaming deserialization use cases, eliminating the need for unsafe code in many situations.
Refer to the API documentation for a complete example.
The end() method has been removed from SeqVisitor and MapVisitor.
This affects custom implementations of Deserialize that deserialize from a sequence or map type. The end() method was too easy to forget to call and it was ambiguous whether it needed to be called on various error codepaths.
The enum deserialization API has been simplified.
This affects custom implementations of Deserialize that process enum types. The new enum API is now much more similar to the sequence and map deserialization APIs and some convoluted indirection has been cleaned up.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Add categories to crates.io (#707, thanks @shepmaster)
Remove #![feature(proc_macro)] feature gates to support serde_derive on the beta channel!
#![feature(proc_macro)] feature gates to support serde_derive on the beta channel!ByteBuf from a string (#645)Implement skip_serializing for enum variants (#653, thanks @shinglyu)
Implement skip_serializing for enum variants (#653, thanks @shinglyu)
#[derive(Serialize)]
enum E {
A(bool),
B(String),
#[serde(skip_serializing)]
C(NotSerializable),
}
Serialization will fail with a message if that particular variant is the one being serialized.
"The enum variant E::C cannot be serialized"
Implement skip_deserializing for enum variants (#641, thanks @shinglyu)
Implement skip_deserializing for enum variants (#641, thanks @shinglyu)
#[derive(Deserialize)]
enum E {
A(bool),
B(String),
#[serde(skip_deserializing)]
C(NotDeserializable),
}
_Support for rustc 1.15.0-nightly (7b3eeea22 2016-11-21)_
Support for rustc 1.15.0-nightly (7b3eeea22 2016-11-21)
_Support for rustc 1.15.0-nightly (ac635aa95 2016-11-18)_
Support for rustc 1.15.0-nightly (ac635aa95 2016-11-18)
_Support for rustc 1.14.0-nightly (7c69b0d5a 2016-11-01)_
Support for rustc 1.14.0-nightly (7c69b0d5a 2016-11-01)
Fix possible warning when building with #![warn(unused_results)] (#599, thanks @TheCatPlusPlus)
#![warn(unused_results)] (#599, thanks @TheCatPlusPlus)Use post-expansion tricks to make serde attributes available to other custom derives like elastic_types_derive
Fix corrupted deserialization code being generated randomly when using serde_codegen (did not affect serde_derive) #590
The empty array [T; 0] now supports deserializing from formats that handle fixed-sized arrays only
[T; 0] now supports deserializing from formats that handle fixed-sized arrays only (#582)[T; 0] no longer requires T: Default in order to deserialize (#583)Update the serde_derive crate type from "rustc-macro" to "proc-macro" to match the blanket rename in Rust (https://github.com/rust-lang/rust/pull/3694
Impl Serialize and Deserialize for `IpAddr` without requiring the unstable feature
Serialize and Deserialize for IpAddr without requiring the unstable feature (#568)This release deprecates the old Serde compiler plugin `serde_macros` in favor of the [Macros 1.1](https://github.com/rust-lang/rfcs/blob/master/text/1…
This release deprecates the old Serde compiler plugin serde_macros in favor of the Macros 1.1-based implementation serde_derive.
We do not intend to release any further version of serde_macros, not even to fix breakage in future nightly versions. The design of Macros 1.1 is such that we do not expect to see the regular breakage with serde_derive that we used to see with serde_macros, as it depends on a far more limited set of unstable compiler internals.
See https://serde.rs/codegen-nightly.html for steps to set up serde_derive, or https://serde.rs/codegen-hybrid.html for steps to set up a hybrid serde_codegen/serde_derive approach that works on stable.
[dependencies]
serde_macros = "0.8"
#![feature(plugin, custom_derive)]
#![plugin(serde_macros)]
[dependencies]
serde_derive = "0.8"
#![feature(rustc_macro)]
#[macro_use]
extern crate serde_derive;
// everything else is the same
_Support for rustc 1.13.0-nightly (1265cbf4e 2016-09-15)_
Support for rustc 1.13.0-nightly (1265cbf4e 2016-09-15)
Fix faulty generated code when using a serialize_with field attribute along with a nonstandard Result type in the same module
serialize_with field attribute along with a nonstandard Result type in the same module (#546)Add a forward_to_deserialize! macro to simplify JSON-like Deserializer implementations that want to ignore type hints given by Deserialize
Add a forward_to_deserialize! macro to simplify JSON-like Deserializer implementations that want to ignore type hints given by Deserialize (#525)
impl Deserializer for MyDeserializer {
fn deserialize<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor
{
/* ... */
}
forward_to_deserialize! {
bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 char str string
unit option seq seq_fixed_size bytes map unit_struct newtype_struct
tuple_struct struct struct_field tuple enum ignored_any
}
}
Add constructors for the Bytes and ByteBuf helpers (#520)
Allow MapDeserializer to be deserialized as a sequence of pairs instead of a map (#527)
Fix warnings in generated code for a non-unit struct with no fields (#536)
Minor cleanup of generated serialization code (#538)
Add a serde_derive crate which provides a Macros 1.1 implementation of #[derive(Serialize, Deserialize)]
serde_derive crate which provides a Macros 1.1 implementation of #[derive(Serialize, Deserialize)] (#530)serde_codegen::expand_str which is necessary for Macros 1.1Using Macros 1.1 requires rustc support (not in nightly yet but available in https://github.com/rust-lang/rust/pull/35957) and cargo support (available in https://github.com/rust-lang/cargo/pull/3064). Using Macros 1.1 looks like this:
Cargo.toml
[dependencies]
serde = "0.8"
serde_derive = "0.8"
src/main.rs
#![feature(rustc_macro)]
#[macro_use]
extern crate serde_derive;
#[derive(Serialize, Deserialize)]
struct ItWorks {
exciting: bool,
}
Advantages of this approach:
_Support for rustc 1.13.0-nightly (eac41469d 2016-08-30)_
Support for rustc 1.13.0-nightly (eac41469d 2016-08-30)
Implement ValueDeserializer for Cow
Cow<str> (#513)Fixes codegen for structs that have a lifetime parameter but no generic type parameter
Using Syntex, serde_codegen::expand now runs with a 16 MB stack by default because the previous default was often insufficient (#494, #503)
serde_codegen::expand now runs with a 16 MB stack by default because the previous default was often insufficient (#494, #503)Impl Serialize and Deserialize for std::Duration
_This release contains significant breaking changes compared to v0.7.x._
This release contains significant breaking changes compared to v0.7.x.
The Serializer trait has been modified to allow for streaming serialization - serializing seq and map elements before knowing what the end of the seq or map will be. (#437)
Reduced boilerplate (no more SeqVisitor and MapVisitor) when implementing Serialize for most types.
// OLD API
struct MySeqVisitor { /* ... */ }
impl /* pages of boilerplate */
try!(serializer.serialize_seq(MySeqVisitor::new(iter, len)));
// NEW API
let mut state = try!(serializer.serialize_seq(len));
for e in iter {
try!(serializer.serialize_seq_elt(&mut state, e));
}
try!(serializer.serialize_seq_end(state));
The Serializer and Deserializer traits no longer provide default implementations for any methods. The old defaults were JSON-centric and inappropriate for most other formats. Every Serializer and Deserializer should mindfully implement all of the methods. (#437, #452)
serde_codegen::register function which was deprecated in v0.7.9 has been removed. Users should use serde_codegen::expand. See the readme for sample code, and see this forum topic for exposition. (#445)PhantomData<T> has been expanded to all T, not just T: Deserialize (#457, #459)Box<str> (#454)nightly feature has been renamed to unstable to align with community practices. (#404)Nothing published for this version
Nothing published for this version
Nothing published for this version
_(this release is a Syntex bump only)_
(this release is a Syntex bump only)
_(this release is a Syntex bump only)_
(this release is a Syntex bump only)
Excludes generated code from Clippy lints (rust-clippy#969)
_(this release is a Syntex bump only)_
(this release is a Syntex bump only)
Better error when attempting to derive Deserialize for a struct containing &str
&str (#378)Adds Serialize and Deserialize support for HashMap and HashSet that use a non-default Hasher
The serde_codegen::register function is deprecated and will be removed in 0.8.0. #362
serde_codegen::expand as an alternative to serde_codegen::register when using the with-syntex feature. This hides the dependency on Syntex and allows Syntex users to avoid being broken by Serde bumping its Syntex dependency. The serde_codegen::register function is deprecated and will be removed in 0.8.0. #362Adds a bound attribute for specifying handwritten where clause for Serialize and Deserialize impls in tricky situations
bound attribute for specifying handwritten where clause for Serialize and Deserialize impls in tricky situations (#352)
#[serde(bound="D: Serialize + Deserialize")]#[serde(bound(serialize="D: Serialize", deserialize="D: Deserialize"))]rename attributes canceling one another if specified separately for ser and de (#353)Reverts an unintentional breaking change in 0.7.6
Enables use in no_std environments, controlled by the following feature flags
alloc (implies nightly)collections (implies alloc and nightly)std (default)Fixes a codegen regression from 0.7.4 that generates invalid code for some generic structs
deserialize_with are no longer required to implement the Deserialize trait (#311)deserialize_with in a struct containing more than one field (#308)deserialize_with in a struct with a type parameter called D (#315)Adds skip_deserializing attribute
skip_deserializing attribute (#265)Box<[T]> (#290)skip_serializing are no longer required to implement the Serialize trait (#260, #285)std::default::Default is inferred for fields that use the default attribute (#285)extern crate serde not in the top-level module (#298)_This release contains significant breaking changes compared to v0.6.x._
This release contains significant breaking changes compared to v0.6.x.
Deserializer::visit_* to Deserializer::deserialize_* (#151)deserialize_ignored_any method to Deserializer trait (#225)de::Error trait (#160, #166, #169, #249, #254)deny_unknown_fields attribute (#44 and #60)default="..." attribute (#90, #216)num crate added in v0.6.6 (#243)_(this release is a Syntex bump only)_
(this release is a Syntex bump only)
_(this release is a Syntex bump only)_
(this release is a Syntex bump only)
_(this release is a Syntex bump only)_
(this release is a Syntex bump only)
Method visit_struct_field has been added to the Deserializer trait to hint that a struct key is expected (#223 and 064241f)
visit_struct_field has been added to the Deserializer trait to hint that a struct key is expected (#223 and 064241f)Allow options to be deserialized from units
Fixes panic when a non-struct/enum is annotated
clippy feature to build with Clippy (bfa2b69)_(this release is a Syntex bump only)_
(this release is a Syntex bump only)
Nothing published for this version
Nothing published for this version
One column per quarter.