Code Generators · Runs in your browser
JSON to C# Class Generator
Paste a JSON sample and get ready-to-use C# classes, with nested types, arrays and optional fields worked out for you. Ideal for ASP.NET Core and HttpClient with System.Text.Json.
JSON
Drop a file to load it
C#
How to use it
- Paste a representative JSON sample, such as an API response.
- Set the root type name and pick a style: classes or positional records.
- Copy the C# code or download it as a file.
System.Text.Json
Every property has a [JsonPropertyName] attribute, so PascalCase property names still map to the original keys.
Nullable reference types
The output enables #nullable, and optional or null fields are typed as nullable.
Integers vs. decimals
Number types come from how the number is written in your sample: 3 is an integer, 3.0 and 3.5 are decimals, and long IDs use a 64-bit type.
More code generators tools
All free, all private, all running locally in your browser.