Add valid JSON
Paste an object or array, or open a local .json file. Nested structures and representative array records produce the best types.
Generate clean C# model classes from real JSON data. Infer nested objects, generic Lists, numeric types, nullable properties, and safe names for System.Text.Json.
Generate reusable C# classes in three focused steps.
Paste an object or array, or open a local .json file. Nested structures and representative array records produce the best types.
Name the root class, choose nullable reference output, and let the converter infer nested property types.
Review the generated source, copy it into your project, or download a ready-to-use .cs file.
The generator examines complete structures rather than guessing from the first property alone.
Objects inside objects receive clear named definitions instead of unreadable inline blocks.
JSON arrays become typed C# Lists, including collections of generated nested model classes.
Original keys are preserved with System.Text.Json JsonPropertyName attributes when required.
JSON parsing and type generation happen locally in your browser without a server upload.
Strings become string, whole numbers become long, decimal numbers become double, booleans become bool, arrays become typed List<T> properties, and objects become named classes.
JSON keys may contain hyphens, spaces, C# keywords, or leading numbers. The generator creates a valid PascalCase property and adds [JsonPropertyName] for accurate System.Text.Json mapping.
Generated classes describe the supplied sample. Include realistic array records and null values so the inferred property types match your API.
// JSON { "id": 42, "name": "Alex", "roles": ["admin", "editor"] } // C# public class Root { public long Id { get; set; } public string Name { get; set; } public List<string> Roles { get; set; } }
Practical details about inference, arrays, nulls, and generated definitions.
Yes. Nested objects become named C# classes, and arrays of objects become typed Lists of generated classes.
Object samples are merged so the generated element class includes fields found across the supplied records.
Known types become nullable, such as long? or string?. A value that is only null becomes object? because its concrete type cannot be inferred.
Yes, when enabled. Nullable strings, objects, and collections receive the ? annotation for modern C# projects.
Yes. The generator creates a safe C# property and adds a JsonPropertyName attribute containing the original key.
An empty array provides no element evidence, so the property is generated as List<object>.
No. Parsing, inference, copying, and downloading happen locally inside your browser.
Yes. The definitions describe the supplied sample. Compare them with your API contract, especially when optional or rare fields may be absent.