
Serialization
This covers JSON, Protocol Buffers, and MessagePack for .NET, with a strong focus on AOT compatibility and moving away from Newtonsoft.Json. The comparison tables are genuinely helpful for deciding between formats: use System.Text.Json with source generators for APIs and web clients, Protobuf for gRPC and service-to-service communication where schema evolution matters, and MessagePack when you need compact binary without managing .proto files. The guidance on avoiding BinaryFormatter and reflection-based serializers is spot on. The examples show real patterns like combining multiple JsonSerializerContext instances and handling polymorphic types with JsonDerivedType. If you're still using Newtonsoft.Json or wondering which binary format fits your use case, this gives you concrete decision criteria and working code.
- skills.sh installs
- 530
- GitHub stars
- 90
- last updated
- Aug 21, 2026
Install
$ npx -y skills add wshaddix/dotnet-skills --skill serialization --agent claude-codeInstalls 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
Serialization Format Comparison
| Format | Library | AOT-Safe | Human-Readable | Relative Size | Relative Speed | Best For |
|---|---|---|---|---|---|---|
| JSON | System.Text.Json (source gen) | Yes | Yes | Largest | Good | APIs, config, web clients |
| Protobuf | Google.Protobuf | Yes | No | Smallest | Fastest | Service-to-service, gRPC wire format |
| MessagePack | MessagePack-CSharp | Yes (with AOT resolver) | No | Small | Fast | High-throughput caching, real-time |
| JSON | Newtonsoft.Json | No (reflection) | Yes | Largest | Slower | Legacy only -- do not use for AOT |
When to Choose What
Sponsors
Details
- Repository
- github.com/wshaddix/dotnet-skills
- Categories
- Debugging, .NET & C#
- First seen
- Jun 3, 2026
More from wshaddix/dotnet-skills
All 13- Microsoft Extensions Configuration528
- Package Management518
- Dotnet Testing Strategy619
- Dotnet Xunit619
- Modern Csharp Coding Standards589
- Csharp Wolverinefx572
- Testcontainers569
- Microsoft Extensions Dependency Injection552
- Logging Observability545
- Validation Patterns542
- Project Structure539
- Dotnet Domain Modeling538