JSON to C# Class Converter
Turn a JSON object into C# classes with auto-property type mapping, in your browser.
How to use
- Paste or type your JSON into the input box.
- Optionally rename the root class (defaults to AutoGenerated).
- Copy the generated classes from the output box.
- Deserialize with System.Text.Json or Newtonsoft.Json — enable case-insensitive property matching so the PascalCase properties bind to the JSON keys.
About this tool
ShowHide
Paste any JSON object or array and get ready-to-use C# class definitions with typed auto-properties and a separate class for each nested object, named after the key that held it. Property names are PascalCased, which is the C# convention and still binds correctly because both Newtonsoft.Json and System.Text.Json can be told to match JSON keys case-insensitively — for System.Text.Json that is PropertyNameCaseInsensitive on the options. That only bridges a difference in letter case, so a key such as first_name or created-at gets a [JsonPropertyName] attribute carrying its original spelling. Whole numbers map to long and fractional ones to double, deliberately wide so large IDs survive. A JSON null becomes object and an empty array becomes List<object>, since one sample cannot say what belongs there; nullable value types are the part to add by hand. Everything runs locally in your browser — your JSON is never uploaded.
Frequently asked questions
How are numbers typed?
Whole numbers become long and numbers with a decimal point become double. Change to int or decimal manually if you prefer a different type.
What happens with null or empty arrays?
null values map to object and empty arrays to List<object>, since their type can't be inferred from the sample.
Why are property names PascalCase?
That's the standard C# convention. Newtonsoft.Json matches keys case-insensitively, and System.Text.Json binds when configured with PropertyNameCaseInsensitive.
Is my JSON sent anywhere?
No. Conversion happens entirely in your browser; nothing is uploaded.
Do I need JsonPropertyName on every property?
Not for a plain case difference. System.Text.Json binds PascalCase properties to camelCase keys once PropertyNameCaseInsensitive is set, and Newtonsoft does it by default. A key with an underscore, a hyphen, a space or any other spelling that PascalCase changes does need it, and the tool adds it for you.
A number field is sometimes null — what breaks?
long and double are value types and cannot hold null, so a JSON null deserializes to zero and you lose the distinction between absent and genuinely zero. Change those to long? and double? — the nullable form — wherever the field is optional.
Related tools
JSON to Kotlin Data Class Converter
Turn a JSON object into Kotlin data classes with typed properties, in your browser.
Developer
JSON to Java Class (POJO) Converter
Turn a JSON object into Java POJO classes with type-mapped fields, in your browser.
Developer
HTML → JSX Converter
Paste an HTML snippet and get React-ready JSX — class becomes className, onclick becomes onClick, and void tags self-close.
Developer
JSON to Go Struct Converter
Turn a JSON object into a typed Go struct with json tags, instantly in your browser.
Developer
JSON to Python Dataclass Converter
Turn a JSON object into Python @dataclass definitions with type hints, in your browser.
Developer
JSON to Rust Struct Converter (serde)
Turn a JSON object into Rust structs with serde derives and type-mapped fields, in your browser.
Developer