serialization

Guide .NET developers in selecting serialization formats like Protobuf, MessagePack, and System.Text.Json.

1.1k|101|Updated Nov 12, 2025
One-click install
npx skills add https://github.com/Aaronontheweb/dotnet-skills --skill serialization-aaronontheweb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: serialization
Source: https://github.com/Aaronontheweb/dotnet-skills/tree/main/skills/serialization
Command: npx skills add https://github.com/Aaronontheweb/dotnet-skills --skill serialization-aaronontheweb

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Choosing the right serialization format for .NET applications, balancing performance, compatibility, and ease of use.

Core Features & Use Cases

  • Schema-based vs reflection-based guidance to help select appropriate formats for APIs, messaging, and persistence.
  • Performance and compatibility considerations, including AOT-ready options like System.Text.Json source generation.
  • Migration guidance from Newtonsoft.Json to System.Text.Json to improve reliability and maintainability.
  • Use cases: design wire formats for distributed systems, versioned contracts, and high-throughput data pipelines.

Quick Start

Analyze a new API or messaging contract and implement System.Text.Json with source generation for best performance and compatibility.

Frequently Asked Questions about serialization

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

FAQPage Schema
What is the best .NET serialization format for high-throughput messaging and data persistence?

Schema-based serialization formats like Protobuf and MessagePack are best for high-throughput messaging and persistence, offering strong performance and strict versioning. They enforce explicit contracts to reduce errors in distributed systems.

How do I migrate from Newtonsoft.Json to System.Text.Json for better reliability?

To migrate from Newtonsoft.Json to System.Text.Json, analyze your API contracts and implement System.Text.Json with source generation. This improves reliability, maintainability, and ensures AOT compatibility for your .NET applications.

Does .NET serialization work with AOT (Ahead-of-Time) compilation?

Yes, .NET serialization works with AOT compilation when using System.Text.Json source generation or schema-based formats like Protobuf and MessagePack. Reflection-based serialization approaches are discouraged for AOT compatibility.

Protobuf vs System.Text.Json: which should I choose for my REST API wire format?

Choose Protobuf for strict schema-based contracts and high-performance messaging, or System.Text.Json with source generation for standard REST APIs requiring AOT compatibility and broad compatibility without reflection overhead.

Why should I avoid reflection-based serialization in .NET distributed systems?

You should avoid reflection-based serialization like Newtonsoft.Json because it introduces runtime overhead, hurts performance, and breaks AOT compatibility. Using source generation or schema-based formats ensures reliable, maintainable wire formats.