JSON to C# Converter
Turn sample JSON into C# model classes with inferred types.
What is this tool?
This converter inspects a JSON value and emits C# class definitions with properties mapped from object keys. Nested objects become separate classes and arrays become List<T>. A key that collides with a C# reserved word (e.g. "class") gets an @ prefix (@class) — the idiomatic C# escape — with a [JsonPropertyName] attribute added so it still (de)serializes to the original key. An array mixing primitive types (e.g. [10, "A+", 9.5]) is represented as List<object?> — C# has no clean idiomatic union-type equivalent for a generated POCO property, unlike the TypeScript and Python converters, which render a real union type for this case. Use it to bootstrap DTOs from API responses.
How to use it
- Paste JSON that represents the shape you want modeled.
- Toggle Preserve original property casing if you do not want PascalCase.
- Copy the generated classes into your .NET project (add System.Text.Json attributes as needed).
Related conversions tools
- .env ⇄ JSON ConverterConvert dotenv key/value files to JSON objects and back.
- JSON to TypeScript ConverterGenerate TypeScript interfaces or types from JSON.
- JSON to Python DataclassGenerate Python dataclasses or Pydantic models from JSON.
- XML ⇄ JSON ConverterConvert XML to JSON and JSON back to XML in one tool.