JSON to C# Class Converter
Generate C# 11 model classes for System.Text.Json with nested types, JsonPropertyName attributes, required properties and nullable fields.
Start with your input
Edit the example or replace it with your own text.
How to use JSON to C# Class Converter
- Paste one JSON object or a non-empty array of representative objects.
- Generate classes inferred from every record, including missing and null fields.
- Use C# 11 and .NET 7 or later, then review the generated contract before deserializing production responses.
Preserve wire names with typed properties
The generator creates PascalCase C# properties and explicit JsonPropertyName attributes, so unusual JSON names remain mapped to their exact wire keys. Nested objects become classes, arrays become List, integer samples choose int or long, and fractional samples choose double. Mixed values fall back to JsonElement rather than inventing a misleading single type.
Presence and nullability have different meanings
A property seen in every sample uses the required modifier, including when its value can be null. A property missing from some samples is nullable and not required. Required presence does not by itself forbid null, and annotations do not replace domain validation. Input arrays represent sample Root records; deserialize actual arrays as List<Root>. Empty arrays cannot establish an object model, and unsafe integer samples are rejected.
Example input
[{"user_id":1,"profile":{"name":"Ada"},"tags":["admin"]},{"user_id":2,"profile":null}]Does required guarantee that a string is nonempty?
No. It requires a property to be present during supported System.Text.Json deserialization. Validate null, length and business rules separately.
Is input uploaded?
Processing takes place in your browser. This tool does not send your input or selected files to a conversion API.