serialization

Solid

Choose the right serialization format for .NET applications. Prefer schema-based formats (Protobuf, MessagePack) over reflection-based (Newtonsoft.Json). Use System.Text.Json with AOT source generators for JSON scenarios.

Data & Documents 978 stars 93 forks Updated 1 months ago MIT

Install

View on GitHub

Quality Score: 91/100

Stars 20%
100
Recency 20%
75
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# 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 | Aspect | Schema-Based | Reflection-Based | |--------|--------------|------------------| | **Examples** | Protobuf, MessagePack, System.Text.Json (source gen) | Newtonsoft.Json, BinaryFormatter | | **Type info in payload** | No (external schema) | Yes (type names embedded) | | **Versioning** | Explicit field numbers/names | Implicit (type structure) | | **Performance** | Fast (no reflection) | Slower (runtime reflection) | | **AOT compatible** | Yes | No | | **Wire compatibility** | Excellent | Poor | **Recommendation**: Use schema-based serialization for anything that crosses process boundaries. --- ## Format Recommendations | Use Case | Recommended Format | Why | |----------|-------------------|-----| | **REST APIs** | System.Text.Json (source gen) | Standard, AOT-compatible | | **gRPC** | Protocol Buffers | Native format, excellent versioning | | **Actor messaging** | MessagePack or Protobuf | Compact, fast, version-safe | | **Event sourcing** | Protobuf or MessagePack | Must handle old events forever | | **Caching** | MessagePack | Compact, fast | | **Configuration** | JSON (System.Text.Json) | Human-re...

Details

Author
Aaronontheweb
Repository
Aaronontheweb/dotnet-skills
Created
6 months ago
Last Updated
1 months ago
Language
Shell
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category