Skip to content
AZ Tools

JSON to C# Class Converter

Turn a JSON object into C# classes with auto-property type mapping, in your browser.

C# classes

How to use

  1. Paste or type your JSON into the input box.
  2. Optionally rename the root class (defaults to AutoGenerated).
  3. Copy the generated classes from the output box.
  4. Deserialize with System.Text.Json or Newtonsoft.Json — enable case-insensitive property matching so the PascalCase properties bind to the JSON keys.

About this tool

Show

Paste any JSON object or array and get ready-to-use C# class definitions with typed auto-properties and a separate class for each nested object, named after the key that held it. Property names are PascalCased, which is the C# convention and still binds correctly because both Newtonsoft.Json and System.Text.Json can be told to match JSON keys case-insensitively — for System.Text.Json that is PropertyNameCaseInsensitive on the options. That only bridges a difference in letter case, so a key such as first_name or created-at gets a [JsonPropertyName] attribute carrying its original spelling. Whole numbers map to long and fractional ones to double, deliberately wide so large IDs survive. A JSON null becomes object and an empty array becomes List<object>, since one sample cannot say what belongs there; nullable value types are the part to add by hand. Everything runs locally in your browser — your JSON is never uploaded.

Frequently asked questions

How are numbers typed?

Whole numbers become long and numbers with a decimal point become double. Change to int or decimal manually if you prefer a different type.

What happens with null or empty arrays?

null values map to object and empty arrays to List<object>, since their type can't be inferred from the sample.

Why are property names PascalCase?

That's the standard C# convention. Newtonsoft.Json matches keys case-insensitively, and System.Text.Json binds when configured with PropertyNameCaseInsensitive.

Is my JSON sent anywhere?

No. Conversion happens entirely in your browser; nothing is uploaded.

Do I need JsonPropertyName on every property?

Not for a plain case difference. System.Text.Json binds PascalCase properties to camelCase keys once PropertyNameCaseInsensitive is set, and Newtonsoft does it by default. A key with an underscore, a hyphen, a space or any other spelling that PascalCase changes does need it, and the tool adds it for you.

A number field is sometimes null — what breaks?

long and double are value types and cannot hold null, so a JSON null deserializes to zero and you lose the distinction between absent and genuinely zero. Change those to long? and double? — the nullable form — wherever the field is optional.

Related tools