serialization

Select optimal serialization formats for .NET applications using schema-based approaches.

Updated Apr 23, 2026
One-click install
npx skills add https://github.com/MudraMartin/dotlight-skillset --skill serialization-mudramartin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: serialization
Source: https://github.com/MudraMartin/dotlight-skillset/tree/main/dotnet/serialization
Command: npx skills add https://github.com/MudraMartin/dotlight-skillset --skill serialization-mudramartin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps developers select and implement the best serialization format for their .NET applications, optimizing for performance and compatibility.

Core Features & Use Cases

  • Choose serialization formats: Guides through selecting between schema-based (Protobuf, MessagePack, System.Text.Json) and reflection-based formats (Newtonsoft.Json).
  • Migration assistance: Provides instructions for migrating from Newtonsoft.Json to System.Text.Json, including handling common issues and best practices.
  • System.Text.Json with source generators: Recommends System.Text.Json with AOT source generators for performance and compatibility with Native AOT publishing.
  • Schema-based formats: Offers in-depth explanations of Protobuf and MessagePack, with setup instructions and best practices for various use cases.
  • Avoid formats to consider: Lists formats like BinaryFormatter and DataContractSerializer that are not recommended due to security vulnerabilities or other limitations.

Quick Start

Choose a serialization format using this Skill by reviewing the format recommendations and guidelines for migrating to System.Text.Json.

Frequently Asked Questions about serialization

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

FAQPage Schema
How do I migrate from Newtonsoft.Json to System.Text.Json in .NET?

To migrate from Newtonsoft.Json to System.Text.Json, you need to adjust attributes and handle reference loops differently. This Skill provides instructions for common migration issues and best practices to ensure compatibility during the transition.

What is the best serialization format for Native AOT in .NET?

For Native AOT compatibility, System.Text.Json with source generators is the recommended serialization format. This approach avoids runtime reflection, optimizing performance and ensuring compatibility when publishing Native AOT .NET applications.

When should I use Protobuf or MessagePack over JSON in .NET?

Use schema-based formats like Protobuf or MessagePack over JSON when you need high performance and cross-system data interchange. This Skill offers setup instructions and best practices for implementing these formats in .NET applications.

Which .NET serialization formats should I avoid for security reasons?

You should avoid BinaryFormatter and DataContractSerializer due to security vulnerabilities and limitations. This Skill identifies formats that are not recommended and guides you toward safer schema-based alternatives for .NET serialization.

How does System.Text.Json source generation work for AOT publishing?

System.Text.Json source generation works by generating serialization code at compile time, eliminating runtime reflection. This mechanism ensures your .NET applications maintain high performance and compatibility when publishing with Native AOT.

Can I use MessagePack for cross-system data interchange in .NET?

Yes, you can use MessagePack for cross-system data interchange in .NET. This Skill explains schema-based formats like MessagePack and Protobuf, providing setup instructions and best practices for various use cases.