JSON to C# Converter
Generate C# classes from a JSON sample directly in your browser.
This tool runs entirely in your browser. Your files are never uploaded to a server.
using System.Collections.Generic;
public class Root
{
public string Name { get; set; }
public int Age { get; set; }
public bool Active { get; set; }
public List<string> Tags { get; set; }
public Address Address { get; set; }
}
public class Address
{
public string Street { get; set; }
public string Zip { get; set; }
}What this converter does
Reads a JSON value and generates matching C# classes: one class per object shape found in the sample, each with public auto-implemented properties.
How to use it
Paste a JSON object, array or primitive value into the editor. A `Root` class appears immediately, along with one additional class for every nested object shape; a non-object root is wrapped in a `Root` class with a single `Value` property.
Example
An object with a `name` string and a nested `address` object produces a `Root` class with `public string Name { get; set; }` plus a separate `Address` class for the nested shape.
Type mapping and naming
Strings become `string`, whole numbers become `int`, decimal numbers become `double`, booleans become `bool`, and arrays become `List<ElementType>` (with the needed `System.Collections.Generic` using directive added automatically). Property names are PascalCased from the JSON key, following C# convention — so a `first_name` key produces a `FirstName` property.
Nested objects and lists
Each nested object gets its own class, generated from its key. Class order in the output doesn't matter in C#, since classes in the same file can reference each other regardless of declaration order.
Limitations
Because property names are PascalCased and no longer match the original JSON key text, deserializing JSON straight into these classes with System.Text.Json or Newtonsoft.Json needs a [JsonPropertyName]/[JsonProperty] attribute added by hand for any key that isn't already PascalCase. The generated classes describe only the one JSON sample provided.
Privacy
Parsing and code generation both run locally in your browser. The JSON you paste and the C# you generate are never uploaded.
Frequently Asked Questions
- Will these classes deserialize my JSON automatically?
- Not always — property names are PascalCased per C# convention, so a JSON key like first_name needs a [JsonPropertyName("first_name")] attribute added to match it back up during deserialization.
- Why PascalCase instead of the original JSON key?
- It follows standard C# naming convention for public properties, which is what most C# developers expect to see and use in their own code.
- Is my JSON sent to a server?
- No — parsing and C# generation both happen locally in your browser.