Free JSON to C# Converter
Paste JSON and get C# classes you can drop into your project — nested objects become nested classes, arrays become lists, and property names follow C# conventions. The generation happens in your browser, so your JSON never leaves your device, and there is no account to create or software to install.
C# classes
Your input never leaves this device — the conversion runs entirely in your browser.
How to generate C# classes from JSON
Paste or type your JSON into the input box, then generate the classes. The C# code appears straight away, ready to copy into your project. Rename the classes to match your own domain, check the property types against your real data, and you are ready to use them.
If the JSON has a mistake in it, generation will not proceed until the text is valid. Paste it into the JSON validator first if anything fails — it shows the first error and its position. Everything runs in your browser, so your JSON is never uploaded or stored.
How JSON types become C# types
Every JSON value maps to a C# type by a fixed rule, so the output is predictable. The table shows the mapping the converter uses:
| JSON value | C# type |
|---|---|
| String | string |
| Whole number | int or long, by value |
| Number with a fraction | double |
| Boolean | bool |
| Null only | object, with a comment |
| Object | A nested class |
| Array | List<T> of the item type |
Numbers deserve a note: a value that fits in an int becomes an int, a larger whole number becomes a long, and a number with a fraction becomes a double. If your real data can hold larger values than the sample shows, widen the type after generating.
Property names and JsonPropertyName
JSON keys often use conventions C# does not: lower-case names, snake_case, or names with spaces and symbols. The converter turns each key into a PascalCase property name, the usual C# style, so first_name becomes FirstName and email becomes Email.
Renaming alone would break the link to the original JSON, so where the JSON key differs from the property name, the converter adds a JsonPropertyName attribute carrying the original key. The output is compatible with System.Text.Json, so deserialising with the standard library reads each property from the correct JSON key. Where the key already matches the property name, no attribute is added.
Working with the generated code
Copy the generated classes into your project and give the top-level class a name that matches what the data represents — a customer, an order, a settings file — rather than keeping a generic name. The nested classes can stay nested, or be moved to their own files if your project prefers one class per file.
Check the types the converter inferred, especially for fields the sample could not pin down. A field that is null in your sample becomes object with a comment, because one sample cannot show its real type — replace it with the type your data actually uses. The same applies to numbers: if a field can exceed the sample's range, widen the type before you rely on it.
The generated code already includes the using directives it needs, including System.Text.Json.Serialization, where the JsonPropertyName attribute lives. The generated code itself is plain C# with no dependencies beyond the standard library.
Limits of generated classes
Generated classes describe one sample, not every possible document. A field that appears in some records but not in your sample will be missing, and a field whose type varies between records will be inferred from the one value the converter saw. Always compare the output with more than one real example before relying on it.
The classes also carry no validation or business logic. They describe the shape of the data and nothing more — checking that values are sensible, required fields are present, or numbers fall in range is your code's job, not the generated code's.
When the JSON shape changes, generate again from a fresh sample rather than patching the old classes by hand. Re-generating keeps the property names, attributes, and nested classes consistent with the data you actually have.
Frequently asked questions
Is the JSON to C# converter free?
Yes. It is free to use, with no account and no sign-up. Generation runs in your browser, so there is nothing to pay for and nothing to install.
Does my JSON leave my device?
No. The classes are generated entirely in your browser. Your JSON is never uploaded, stored, or sent to a server.
Which JSON library does the output work with?
The output is compatible with System.Text.Json, the standard JSON library in modern .NET. JsonPropertyName attributes are added only where the JSON key differs from the property name, so deserialisation reads each property from the correct key.
How are arrays handled?
Arrays become List
What happens to nested objects?
Each nested object becomes its own nested class, named from its key. You can keep the classes nested or move them to separate files, and rename them to match your domain.
What happens to values that are always null?
A value that is only ever null in your sample becomes object, with a comment saying so. One sample cannot reveal the real type, so replace it with the type your data actually uses.
What if my JSON is invalid?
Generation needs valid JSON. Paste the text into the JSON validator to find the first error and its position, fix it, and generate again.



