serde-rs/serde
Developer ToolsA Rust framework for serializing and deserializing data structures, with support for many formats through separate crates.
Overview
Serde is a serialization framework for Rust: it provides the Serialize and Deserialize traits so that Rust structs and enums can be converted to and from data formats. The core crate contains the traits and API, while each data format lives in its own crate (JSON via serde_json, plus formats such as MessagePack, YAML and TOML). It is aimed at Rust developers who need typed, generic conversion between in-memory data and wire or storage formats.
The derive feature generates implementations for your own types through #[derive(Serialize, Deserialize)], avoiding hand-written conversion code. The project also documents no-std usage and a minimum supported Rust version.
Quick start
Add the core crate and a format crate to Cargo.toml:
[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Then derive the traits on a type and convert values with the format crate:
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
struct Point {
x: i32,
y: i32,
}
fn main() {
let point = Point { x: 1, y: 2 };
let serialized = serde_json::to_string(&point).unwrap();
println!("serialized = {}", serialized);
let deserialized: Point = serde_json::from_str(&serialized).unwrap();
println!("deserialized = {:?}", deserialized);
}
The example prints the JSON string and parses it back into a Point; the documentation includes a playground link for this snippet. For choosing formats and setting up derive, see the project overview and data-format list or the derive guide; the API reference covers individual traits and attributes.
Constraints
serdeitself requires Rust 1.56 or newer, whileserde_deriverequires Rust 1.71 or newer; check these when pinning toolchains.- Format support is not part of the core crate: you must add a separate crate for each format, so available behavior depends on that crate.
- The
derivefeature is needed only when using#[derive(Serialize, Deserialize)]; code that implements the traits manually does not need it. - The README notes no-std support but does not spell out configuration details; the crate documentation is the place to check for a specific target.
- Serde is dual-licensed under Apache-2.0 or MIT, at your option.
HotRepo's take
The repository recorded 102 stars gained on the Rust daily list for 2026-11-07, at position 14, with 11,046 stars and 990 forks in that snapshot. Its Hacker News history centers on two moments: the 2017 1.0 release drew 273 points, and the 2023 episode around precompiled binaries in serde_derive drew several threads (122, 98 and smaller follow-ups). Those threads ultimately record removal of the precompiled binaries, and commenters there debated whether the Rust ecosystem's review process would catch such changes quickly. For users, the practical takeaway is that build and dependency provenance are worth checking when upgrading, not a judgment on the framework's core function.
Written by AI from the project's README, updated . The project's own docs are the source of truth.