serialization

Select optimal serialization formats for .NET applications.

Updated Mar 3, 2026
One-click install
npx skills add https://github.com/Thorstensen/claude-template --skill serialization-thorstensen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: serialization
Source: https://github.com/Thorstensen/claude-template/tree/main/.claude/skills/serialization
Command: npx skills add https://github.com/Thorstensen/claude-template --skill serialization-thorstensen

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide helps teams pick the right .NET serialization approach for APIs, messaging, and persistence, prioritizing schema-based formats and AOT-friendly JSON.

Core Features & Use Cases

  • Protobuf, MessagePack, and System.Text.Json with source generators as high-performance, versioning-friendly options.
  • Migration guidance from Newtonsoft.Json to System.Text.Json with minimal disruption.
  • Guidance on wire formats, compatibility, and when to prefer schema-based serializers.

Quick Start

Evaluate your data needs and select a format (Protobuf, MessagePack, or System.Text.Json with source generation) aligned to performance, compatibility, and versioning, then apply the chosen approach in your project.

Frequently Asked Questions about serialization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What's the best .NET serialization format for performance and versioning?

Schema-based formats like Protobuf and MessagePack are best for .NET serialization when prioritizing performance and versioning, as they enforce strict contracts and avoid reflection overhead.

How do I migrate from Newtonsoft.Json to System.Text.Json with minimal disruption?

Migrating from Newtonsoft.Json to System.Text.Json involves evaluating data needs and applying source generators for AOT compatibility, ensuring minimal disruption by aligning format choices with performance goals.

Does System.Text.Json support Ahead-of-Time (AOT) compilation in .NET?

System.Text.Json supports AOT compilation in .NET by using source generators, which eliminate reflection at runtime and ensure compatibility for trimmed or ahead-of-time compiled applications.

When should I use Protobuf over MessagePack for gRPC and event-sourcing?

Use Protobuf over MessagePack for gRPC and event-sourcing when strict schema enforcement and cross-language compatibility are required, whereas MessagePack is preferred for compact binary persistence.

Can I use schema-based serialization for REST APIs instead of reflection-based JSON?

You can use schema-based serialization formats like Protobuf or MessagePack for REST APIs to replace reflection-based JSON, ensuring better wire format efficiency and stricter versioning compatibility.

Why does choosing a schema-based serializer improve versioning compatibility?

Choosing a schema-based serializer improves versioning compatibility because it defines strict data contracts upfront, preventing breaking changes during message evolution across REST, gRPC, and persistence layers.