How to use the JSON to C# Classes
- Paste a representative JSON sample.
- Set the root class name and choose classes or records.
- Copy or download the generated code.
What does this tool do?
The generator infers C# types from your values — int, long, double, bool, DateTime, string — creates a class for every nested object and a List<T> for every array.
Property names are converted to PascalCase, and [JsonPropertyName] attributes keep them mapped to the original JSON keys for System.Text.Json. Keys that are missing or null in some items become nullable. Everything runs in your browser; nothing you paste is uploaded.
Why use it?
- Classes or records.
- Nested objects and arrays handled.
- System.Text.Json attributes.
Privacy
The calculation happens instantly in your browser. The numbers you enter are not sent to our servers or saved. There's no account to create and nothing to install.
Frequently asked questions
Does it work with Newtonsoft.Json?
Yes — Newtonsoft matches PascalCase properties to camelCase keys by default. Untick the attributes option for cleaner code.
Last reviewed by the M2Toolkit team.