System Text JSON Source Generation Aot

Use when System.Text.Json runs under Native AOT or trimming (PublishAot / PublishTrimmed), or when you want the faster, reflection-free serialization path — i.e. a JsonSerializerContext with [JsonSerializable]. Reflection-based JsonSerializer compiles but THROWS at run time under AOT; the source generator is the only supported path. Also covers configuring a context with [JsonSourceGenerationOptions] and why naming policy is per-context, not per-model, so one type serialized by two contexts can emit two different spellings, plus word-valued enums that must remain trim/AOT-safe.

richlander Updated

File contents

richlander/dotnet-package-skills/tree/main/examples/system-text-json/skills/system-text-json-source-generation-aot commit fb87f0dd38

Frequently asked questions

npx skillmds@latest add richlander/system-text-json-source-generation-aot