serde_with

Custom de/serialization helpers for Rust's serde, via the with and serde_as annotations

Library
Cargo
v3.24.0
860 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
86 /100 Excellent
Development Activity 96
Maintenance 96
Community 64
Maturity 60
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
79 /100 Good
Architecture 80
Code Quality 88
Innovation 78
Learning Curve 68

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 empty Option field on a struct without annotating each one individually
  • with_prefix!/with_suffix! macros to add a name prefix/suffix to all fields of a struct without touching its de/serialize impls
  • StringWithSeparator for 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

Go
32%
Apache 2.0

CubeSandbox

AI Agents · Developer Tools · Security

12,728

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.

View details
82
Repo Health
88
Technical
63
Dependency
Built with
Go 32%
Rust 26%
C 22%
Updated 1 weeks ago
TypeScript
73%
AGPL 3.0

Firecrawl

AI Development · Developer Tools

185,614

Turn any website into clean, LLM-ready data with a single API call — no proxy headaches, no scraping complexity.

View details
89
Repo Health
83
Technical
65
Dependency
Built with
TypeScript 73%
Python 13%
Updated 5 days ago
TypeScript
61%
EPL-2.0

Huly Platform

Collaboration · Project Management · Team Chat

27,797

Open-source all-in-one workspace that replaces Linear, Jira, Slack, and Notion for product and engineering teams.

View details
90
Repo Health
86
Technical
62
Dependency
Built with
TypeScript 61%
Svelte 34%
Updated 1 weeks ago
Rust
43%
Apache 2.0

LanceDB

AI Development · Databases

11,544

Open-source, embedded vector database built on the Lance columnar format for fast multimodal search across billions of vectors, backed by Y Combinator (W23).

View details
90
Repo Health
86
Technical
71
Dependency
Built with
Rust 43%
Python 25%
HTML 23%
Updated 6 days ago
Rust
97%
Apache 2.0

codex

AI Code Assistants · Developer Tools

126,822

OpenAI's open-source CLI coding agent that reads, edits, and runs code in your terminal using natural language prompts.

View details
89
Repo Health
80
Technical
75
Dependency
Built with
Rust 97%
Updated 5 days ago
Rust
63%
MIT

PostgresML

AI Development · Databases

6,825

Run ML training and LLM inference natively inside PostgreSQL with GPU acceleration — no data movement required.

View details
51
Repo Health
76
Technical
64
Dependency
Built with
Rust 63%
JavaScript 11%
Updated 1 years ago
Rust
72%
Apache 2.0

Rivet

AI Agents · Developer Tools

6,195

Stateful actors as a primitive for AI agents, real-time collaboration, and durable execution — with in-memory state, WebSockets, queues, and scheduling built in.

View details
86
Repo Health
81
Technical
64
Dependency
Built with
Rust 72%
TypeScript 25%
Updated 1 weeks ago
Rust
77%
AGPL 3.0

Spacedrive

Collaboration · File Storage

39,041

One file manager for all your devices and clouds — powered by a Virtual Distributed File System built in Rust.

View details
56
Repo Health
84
Technical
63
Dependency
Built with
Rust 77%
TypeScript 20%
Updated 2 months ago
Rust
97%
Apache 2.0

Volga

Data Engineering

161

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.

View details
67
Repo Health
67
Technical
72
Dependency
Built with
Rust 97%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers