Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Provides guidance on new System.Text.Json APIs introduced in .NET 11. It covers typed JsonTypeInfo access via GetTypeInfo<T> and TryGetTypeInfo<T> on JsonSerializerOptions, and the new JsonNamingPolicy.PascalCase static property. Use when serializing or deserializing JSON in .NET 11 applications and needing typed metadata access or PascalCase property naming.
.claude/skills/managedcode-system-text-json-net11/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -11% | 0% |
| case-07 | ✗→✓ | ▲ Improved | -66% | 0% |
| case-08 | ✗→✓ | ▲ Improved | -13% | 0% |
| case-10 | ✗→✓ | ▲ Improved | -27% | 0% |
| case-13 | ✗→✓ | ▲ Improved | -16% | 0% |
New APIs added to System.Text.Json across .NET 11 releases.
JsonTypeInfo<T> access instead of the untyped JsonTypeInfo overloadTryGetTypeInfo<T>)System.Text.Json (e.g., Newtonsoft.Json)GetTypeInfo(Type) / TryGetTypeInfo(Type, ...) overloads are sufficientxml<TargetFramework>net11.0</TargetFramework>
JsonTypeInfo AccessJsonSerializerOptions.GetTypeInfo<T>()Returns a strongly-typed JsonTypeInfo<T> for the specified type, using the options' configured type-info resolver.
csharpJsonTypeInfo<T> GetTypeInfo<T>()
JsonSerializerOptions.TryGetTypeInfo<T>(out JsonTypeInfo<T>?)Attempts to retrieve typed metadata without throwing if the type is not resolved.
csharpbool TryGetTypeInfo<T>(out JsonTypeInfo<T>? typeInfo)
JsonNamingPolicy.PascalCaseA new static property that converts property names to PascalCase during serialization.
csharpstatic JsonNamingPolicy PascalCase { get; }
csharpusing System.Text.Json; using System.Text.Json.Serialization.Metadata; var options = new JsonSerializerOptions(JsonSerializerDefaults.Web); // Retrieve strongly-typed metadata for MyClass JsonTypeInfo<MyClass> typeInfo = options.GetTypeInfo<MyClass>(); Console.WriteLine($"Type: {typeInfo.Type.Name}");
csharpusing System.Text.Json; using System.Text.Json.Serialization.Metadata; var options = new JsonSerializerOptions(JsonSerializerDefaults.Web); if (options.TryGetTypeInfo<MyClass>(out var info)) { Console.WriteLine($"Resolved type info for {info!.Type.Name}"); } else { Console.WriteLine("Type info not available"); }
csharpusing System.Text.Json; var opts = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.PascalCase }; var obj = new { firstName = "John", lastName = "Doe" }; string json = JsonSerializer.Serialize(obj, opts); Console.WriteLine(json); // Output: {"FirstName":"John","LastName":"Doe"}
csharpusing System.Text.Json; using System.Text.Json.Serialization.Metadata; var options = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.PascalCase }; JsonTypeInfo<Person> typeInfo = options.GetTypeInfo<Person>(); string json = JsonSerializer.Serialize(new Person("Jane", 30), typeInfo); Console.WriteLine(json); // Output: {"Name":"Jane","Age":30} public record Person(string Name, int Age);
Other measured skills in the registry, with their headline benchmark lift.