serde_with
Custom de/serialization helpers for Rust's serde, via the with and serde_as annotations
Repository Health
Technical Analysis
serde_with provides a large library of custom serialization/deserialization adapters for use with serde’s #[serde(with = "...")] attribute and its own more flexible #[serde_as] annotation. It handles common pain points serde doesn’t solve out of the box: converting via Display/FromStr, serializing arrays larger than 32 elements or with const generics, skipping empty Option fields en masse, adding field-name prefixes/suffixes, and parsing delimiter-separated strings into collections.
Maintained by Jonas Bushart since 2017, it’s one of the most widely used serde companion crates in the Rust ecosystem, with well over 300 million total downloads and adapters for many popular crates (chrono, hashbrown, indexmap, and more) gated behind feature flags.
What You Get
#[serde_as]attribute with dozens of built-in adapters:DisplayFromStr,Hex,Base64,DurationSeconds,Bytes, and more- Support for arrays larger than 32 elements and const-generic arrays, which serde’s derive macros can’t handle natively
#[skip_serializing_none]to skip every emptyOptionfield on a struct without annotating each one individuallywith_prefix!/with_suffix!macros to add a name prefix/suffix to all fields of a struct without touching its de/serialize implsStringWithSeparatorfor parsing delimiter-separated strings (e.g. comma-separated tags) into typed collections- Optional feature-gated integrations for chrono, hashbrown, indexmap, and other common crates’ types
Common Use Cases
- Serializing/deserializing types via their Display/FromStr impls (e.g. u8 as a JSON string, url::Url, mime::Mime)
- Working around serde’s 32-element array limitation, especially with const-generic array sizes
- Compact JSON APIs that omit null/absent optional fields entirely rather than serializing them as null
- Converting comma- or delimiter-separated string fields (common in config files and query params) into Vec<T>
Under The Hood
Architecture - The repo is a Cargo workspace of three crates: serde_with (the public API, ~22.5k lines across adapters organized by target format like base64.rs, hex.rs, chrono_0_4.rs), serde_with_macros (the proc-macro crate implementing #[serde_as], #[skip_serializing_none], and the derive-macro plumbing), and serde_with_test (an internal integration-test harness); the serde_as attribute works by expanding to type-level wrapper structs that implement Serialize/Deserialize and delegate to the underlying value via the requested conversion. Tech Stack - Built on serde/serde_derive with numerous optional feature-gated dependencies (chrono, hashbrown across several versions, indexmap, base64, hex) so consumers only compile in the adapters they use; edition 2021, MSRV 1.88, dual MIT/Apache-2.0 licensed. Code Quality - Extensive per-adapter integration tests (tests/base64.rs, tests/hex.rs, tests/chrono_0_4.rs, plus a dedicated tests/derives subdirectory), workspace-wide Clippy lints (clippy.toml) and strict rustfmt config, CII Best Practices badge, and Bors-managed merge queue (bors.toml) — signals of a mature, process-disciplined project with 1,784 commits over eight years. API Design - The serde_as annotation’s type-mirroring syntax (Vec<DisplayFromStr>, Option<[_; M]>) is more expressive and composable than serde’s plain with attribute, letting nested nested generic types each specify their own conversion, at the cost of a steeper initial learning curve for developers unfamiliar with the type-mirroring convention.
Used by 10 apps in this directory
CubeSandbox
Developer Tools · Security · AI Agents
Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.
Firecrawl
AI Development · Developer Tools
Turn any website into clean, LLM-ready data with a single API call — no proxy headaches, no scraping complexity.
Huly Platform
Project Management · Team Chat · Collaboration
Open-source all-in-one workspace that replaces Linear, Jira, Slack, and Notion for product and engineering teams.
LanceDB
Databases · AI Development
Open-source, embedded vector database built on the Lance columnar format for fast multimodal search across billions of vectors, backed by Y Combinator (W23).
codex
AI Code Assistants · Developer Tools
OpenAI's open-source CLI coding agent that reads, edits, and runs code in your terminal using natural language prompts.
PostgresML
Databases · AI Development
Run ML training and LLM inference natively inside PostgreSQL with GPU acceleration — no data movement required.
Rivet
AI Agents · Developer Tools
Stateful actors as a primitive for AI agents, real-time collaboration, and durable execution — with in-memory state, WebSockets, queues, and scheduling built in.
Spacedrive
File Storage · Collaboration
One file manager for all your devices and clouds — powered by a Virtual Distributed File System built in Rust.
Volga
Data Engineering
A Rust-based real-time data processing engine for AI/ML feature computation, built on Apache DataFusion and Arrow — positioned as an alternative to Flink, Spark, Chronon, and OpenMLDB with unified streaming, batch, and request-time execution.