This is a reference guide for picking serialization formats in .NET, with a strong opinion: use schema-based formats like Protobuf or MessagePack over reflection-based ones like Newtonsoft.Json. It walks you through System.Text.Json with source generators for AOT compatibility, shows you how to version Protobuf schemas without breaking old readers, and explains when to use what (gRPC gets Protobuf, caching gets MessagePack, REST APIs get System.Text.Json). The migration section from Newtonsoft is solid, covering the attribute differences and polymorphism gotchas. If you're building distributed systems or planning for Native AOT, the wire compatibility patterns alone are worth reading.

skills.sh installs
596
GitHub stars
1.3K
last updated
Aug 21, 2026

Install

$ npx -y skills add aaronontheweb/dotnet-skills --skill serialization --agent claude-code

Installs into .claude/skills of the current project.

Files

Serialization in .NET

When to Use This Skill

Use this skill when:

  • Choosing a serialization format for APIs, messaging, or persistence
  • Migrating from Newtonsoft.Json to System.Text.Json
  • Implementing AOT-compatible serialization
  • Designing wire formats for distributed systems
  • Optimizing serialization performance

Schema-Based vs Reflection-Based

AspectSchema-BasedReflection-Based
ExamplesProtobuf, MessagePack, System.Text.Json (source gen)Newtonsoft.Json, BinaryFormatter
Type info in payloadNo (external schema)Yes (type names embedded)
VersioningExplicit field numbers/namesImplicit (type structure)
PerformanceFast (no reflection)Slower (runtime reflection)
AOT compatibleYesNo
Wire compatibilityExcellentPoor

Recommendation: Use schema-based serialization for anything that crosses process boundaries.


Format Recommendations

Sponsors

Details

Repository
github.com/aaronontheweb/dotnet-skills
Categories
Code Review & Quality, .NET & C#
First seen
Jun 3, 2026

More from aaronontheweb/dotnet-skills

All 34
1withastro avatarastro-developerwithastro/astroComprehensive guide for developing in the Astro monorepo. Covers architecture, debugging, testing, and critical constraints. Use when working on features, fixes596skills.sh installs
2davila7 avatarcto-advisordavila7/claude-code-templatesTechnical leadership guidance for engineering teams, architecture decisions, and technology strategy. Includes tech debt analyzer, team scaling calculator, engi595skills.sh installs
3mhattingpete avatarcodebase-documentermhattingpete/claude-skills-marketplaceGenerates comprehensive documentation explaining how a codebase works, including architecture, key components, data flow, and development guidelines. Use when u594skills.sh installs
4omer-metin avatarpixel-artomer-metin/skills-for-antigravityDeep pixel art expertise covering fundamentals, limited palettes, dithering patterns, subpixel animation, tile design, retro hardware constraints, and HD-2D hyb594skills.sh installs
5wanshuiyin avatarresearch-pipelinewanshuiyin/auto-claude-code-research-in-sleepFull end-to-end research pipeline: from a broad research direction through idea discovery, experiments, and review all the way to a polished paper PDF. Use when594skills.sh installs
6opensearch-project avataropensearch-skillsopensearch-project/opensearch-agent-skillsBuild search applications and query log analytics data with OpenSearch. Use this skill when the user mentions OpenSearch, search app, index setup, search archit593skills.sh installs