LazyTools

🔒 Every tool runs in your browser — the files and values you enter are never uploaded to any server. How it works

💠 JSON to C# Class Converter

Paste JSON and get C# classes with properties and JsonPropertyName attributes — nested classes and List types handled for you.

2 classes generated

Rate this tool:
Anonymous — no account, no identifier

How the json to c# class converter works

The converter parses your JSON and emits C# classes with auto-properties. Whole numbers become int, decimals double, booleans bool, strings string, arrays List<...> and nested objects their own class. Property names are PascalCased (C# convention); when that differs from the JSON key a [JsonPropertyName("original_key")] attribute (System.Text.Json) is added so serialization round-trips correctly. The needed using directives are included.

This produces model classes ready for System.Text.Json’s JsonSerializer.Deserialize in seconds. Refine to taste: a whole number is typed int (use long or decimal where needed), reference types are non-nullable by default (add ? for nullable fields under nullable reference types), and you can switch the attribute to Newtonsoft’s [JsonProperty] if your project uses Json.NET instead. Everything runs locally in your browser.

Frequently asked questions

How do I convert JSON to a C# class?

Paste a JSON sample and the tool generates C# classes with properties. Copy them into your project and deserialize with System.Text.Json’s JsonSerializer.

Does it map snake_case JSON to C# properties?

Yes — properties are PascalCased (e.g. user_name → UserName) and a [JsonPropertyName("user_name")] attribute is added so System.Text.Json maps them back to the original keys.

Which JSON library are the attributes for?

System.Text.Json (the built-in .NET serializer), using [JsonPropertyName]. If you use Newtonsoft Json.NET, swap in [JsonProperty("…")] — the property names and types stay the same.

What number types does it use?

Whole numbers become int and decimals double. For large integers or money values, change to long or decimal after generating — inference goes on the sample only.

Is my JSON uploaded?

No — the conversion runs entirely in your browser and works offline, so your data never leaves your device.

Related developer tools

From the blog