Skip to main content
Back to Blog
.NET 10: System.Text.Json Improvements — What Every Developer Should Know

.NET 10: System.Text.Json Improvements — What Every Developer Should Know

4 min read6 views0 likes
#dotnet#dotnet-10#system-text-json#serialization#csharp

Explore the key System.Text.Json improvements in .NET 10, including nullable reference type enforcement, numeric serialization fixes, and enhanced JsonSchemaExporter capabilities.

.NET 10: System.Text.Json Improvements — What Every Developer Should Know

System.Text.Json continues to evolve in .NET 10 with meaningful improvements focused on correctness, schema generation, and developer ergonomics. If you rely on JSON serialization in your .NET applications — and let's be honest, nearly everyone does — these changes are worth understanding.

As someone who has watched this library mature from its initial release in .NET Core 3.0, I'm genuinely impressed by the direction the team is taking. Let's walk through the most impactful changes.

Nullable Reference Type Enforcement in Deserialization

One of the headline features is respect for nullable reference type annotations during deserialization. Previously, System.Text.Json would silently allow null values for non-nullable reference type properties. In .NET 10, you can opt into stricter behavior:

var options = new JsonSerializerOptions
{
    RespectNullableAnnotations = true
};

With this enabled, deserializing a JSON payload that contains null for a non-nullable string property will throw a JsonException. This is a significant step toward catching data integrity issues at the serialization boundary rather than deep inside your business logic.

You can also enable this globally via the System.Text.Json.Serialization.RespectNullableAnnotationsDefault AppContext switch.

Numeric Type Serialization Fixes

The Half, Int128, UInt128, and NFloat types now serialize correctly in all scenarios. Previous versions had edge cases where these types wouldn't round-trip properly. .NET 10 fixes this, making System.Text.Json a more reliable choice for applications dealing with scientific computing or high-precision data.

JsonSchemaExporter Enhancements

The JsonSchemaExporter — introduced as a preview in .NET 9 — is now more capable. This API generates JSON Schema documents from .NET types, which is incredibly useful for:

  • API documentation — auto-generating schemas for OpenAPI specs
  • Validation — producing schemas for client-side or server-side validation
  • AI tooling — defining function parameter schemas for LLM tool-calling

In .NET 10, the exporter handles more edge cases around polymorphic types, required properties, and JsonDerivedType configurations. If you previously had to hand-craft schemas for complex type hierarchies, this is a welcome improvement.

Customizable Indentation

A small but appreciated change: you can now customize the indentation character and size when writing formatted JSON:

var options = new JsonSerializerOptions
{
    WriteIndented = true,
    IndentCharacter = ' ',
    IndentSize = 4
};

No more being locked into the default two-space indentation. Teams with specific formatting standards can now enforce them directly through serializer options.

JsonObject Property Ordering

The JsonObject type now respects insertion order by default and provides an IndexOf method. This is particularly useful when building dynamic JSON documents where property order matters — for example, when generating configuration files or API responses where humans will read the raw output.

Performance: Still a Priority

While .NET 10's System.Text.Json updates lean more toward correctness and features, performance hasn't been ignored. Internal optimizations reduce allocations in common serialization paths, and the source generator continues to produce faster code with each release.

Benchmarks show modest but consistent gains in throughput for typical DTOs compared to .NET 9, particularly when using source-generated contexts.

What This Means in Practice

These improvements collectively signal that System.Text.Json is maturing into a truly production-grade serialization library. The nullable annotations support alone eliminates an entire class of bugs I've seen in real-world codebases.

My recommendation: if you're starting a new .NET 10 project, enable RespectNullableAnnotations from day one. For existing projects, add it to your test configurations first — you might be surprised what it catches.

Getting Started

.NET 10 is currently in preview, with general availability expected in November 2026. You can try these features today:

dotnet new console -f net10.0

The System.Text.Json improvements require no additional NuGet packages — they ship as part of the base runtime.


The .NET ecosystem continues to refine the tools we use every day. These System.Text.Json improvements might not make headlines, but they'll prevent real bugs in real applications — and that's what matters most.

© 2026 Ahmed Shaltoot. All rights reserved.