JSON to C# Classes
Paste a JSON sample to generate matching C# class definitions. Runs entirely in your browser.
How it works
Each JSON object becomes a C# class with PascalCase { get; set; }
properties. Nested objects become nested classes, arrays become
List<T>, integers within the int32 range become int
(larger ones long), and non-integer numbers become double.
Examples
| JSON | Generated C# |
|---|---|
{"id": 1, "name": "Alice"} |
public class Root
{
public int Id { get; set; }
public string Name { get; set; }
} |
FAQ
What happens with a null value? The property gets type
object with a comment noting the type couldn't be inferred from a single
sample — check the real API response for the actual type.
What about array element class names? They're derived from the
property name (e.g. items → class Items), not singularized —
rename manually if you want Item instead.
Does this only work from one JSON sample? Yes — types are guessed from a single example, not unified across multiple samples (e.g. a field that's sometimes a string and sometimes null won't be detected as nullable unless the sample you paste actually contains a null).