JSON to C# Class

Generate C# classes from JSON

About JSON to C# Class

JSON to C# Class generates a single 'Root' class with one property per top-level JSON key, entirely in your browser — nothing is uploaded to a server. Strings, numbers, and booleans map to string, double, and bool; arrays always become a generic List of object, and nested objects become plain object, since nested values aren't recursively converted into their own classes.

How to use JSON to C# Class

  1. 1Paste your JSON into the input box.
  2. 2Click 'Convert' to generate a C# class from the top-level properties.
  3. 3Review the output — adjust types and add nested classes by hand where needed.
  4. 4Click 'Copy' to copy the code into your project.

Frequently Asked Questions

Is JSON to C# Class free to use?

Yes, it's completely free with no signup required.

Does it handle nested objects and arrays as their own classes?

No — only top-level keys become typed properties. Nested objects are typed as plain object and arrays as List<object>, rather than generating separate nested classes.

Is the generated code ready to use as-is?

For flat JSON with simple string, number, and boolean values, yes. For nested data, you'll need to manually define and wire up additional classes for the nested structures.

Is my data uploaded to a server?

No, generation happens entirely in your browser.

Tips & Tricks

  • Property names are capitalized only on the first letter (e.g. first_name becomes First_name, not FirstName) — rename them by hand if you want strict PascalCase.
  • For nested objects or arrays of objects, manually create additional classes and update the generated property types to match.
  • Numbers always map to double, even if your data is really an integer — change the type if you need int or decimal precision.
  • Test deserialization with real sample data, especially for any properties you retype after generation.