system-text-json-net11

Applies the System.Text.Json APIs added in .NET 11 for PascalCase naming and typed metadata access.

1|Updated Jul 27, 2026
One-click install
npx skills add https://github.com/FittyAr/Cardscape --skill system-text-json-net11-fittyar
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: system-text-json-net11
Source: https://github.com/FittyAr/Cardscape/tree/main/.agents/skills/system-text-json-net11
Command: npx skills add https://github.com/FittyAr/Cardscape --skill system-text-json-net11-fittyar

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers targeting .NET 11 often write unnecessary custom JsonNamingPolicy subclasses, cast non-generic JsonTypeInfo results, or wrap GetTypeInfo in try/catch blocks because they are unaware of the new built-in APIs. This Skill ensures the correct .NET 11 System.Text.Json APIs are applied and verified with runnable output. ## Core Features & Use Cases - PascalCase JSON output: Uses the built-in JsonNamingPolicy.PascalCase static property instead of hand-written naming policies or per-member JsonPropertyName attributes. - Strongly-typed metadata: Retrieves JsonTypeInfo<T> directly via the generic GetTypeInfo<T>() overload, eliminating casts from the non-generic overload. - No-throw metadata probing: Uses TryGetTypeInfo<T>(out info) to branch on metadata availability without exception handling. - Use Case: When serializing a record with lowercase member names in a net11.0 console app, apply JsonNamingPolicy.PascalCase with a DefaultJsonTypeInfoResolver and run dotnet run to confirm the output prints {"Name":"Jane","Age":30}. ## Quick Start Ask the assistant to serialize a C# record to PascalCase JSON using the built-in .NET 11 naming policy and run the program to show the output.

Frequently Asked Questions about system-text-json-net11

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

FAQPage Schema
How do I get PascalCase JSON property names in System.Text.Json?▼

Set PropertyNamingPolicy = JsonNamingPolicy.PascalCase on your JsonSerializerOptions in .NET 11. This built-in static property replaces writing a custom JsonNamingPolicy subclass or adding JsonPropertyName attributes to every member.

How do I get a strongly-typed JsonTypeInfo<T> from JsonSerializerOptions?▼

Call the generic options.GetTypeInfo<T>() method, which returns JsonTypeInfo<T> directly without casting. The options must have a TypeInfoResolver set, such as DefaultJsonTypeInfoResolver, or the call throws NotSupportedException.

Does JsonNamingPolicy.PascalCase work on .NET 10 or earlier?▼

No, JsonNamingPolicy.PascalCase, GetTypeInfo<T>(), and TryGetTypeInfo<T>() only exist in the .NET 11 base class library. Projects targeting net10.0 or earlier must use a custom naming policy or the non-generic GetTypeInfo overload.

Why does GetTypeInfo<T>() throw NoMetadataForType?▼

The exception occurs when JsonSerializerOptions has no TypeInfoResolver configured. Set TypeInfoResolver = new DefaultJsonTypeInfoResolver() for reflection-based apps, or use a source-generated JsonSerializerContext for trimmed or AOT scenarios.

Why does JSON serialization fail in a dotnet run app.cs file-based app?▼

File-based apps disable System.Text.Json reflection by default, so plain serialization throws NoMetadataForType. Add TypeInfoResolver = new DefaultJsonTypeInfoResolver() to the options, or run the code as a regular console project instead.

How do I check if JSON metadata is available without catching exceptions?▼

Use options.TryGetTypeInfo<T>(out var info), which returns false instead of throwing when no resolver can produce metadata for T. Handle both the true and false branches explicitly rather than wrapping GetTypeInfo in try/catch.