🛠️ Developer & Web

JSON to C# Class Converter

Paste a JSON sample — get C# types instantly.

  • Freeno limits, no watermark
  • 0sign-ups or accounts
  • Privateruns on your device
  • Any devicephone, tablet or PC

How the types are inferred

The generator reads your sample and infers a type for every field: strings, integers and decimals, booleans, nested objects (each gets its own named C# type) and arrays. If an array holds several objects, all of them are merged — fields missing from some items become optional and fields that are sometimes null become nullable, so one representative response is usually enough. Field names that aren’t valid identifiers are converted and mapped back to the original JSON key.

Using the C# code

Properties use PascalCase with [JsonPropertyName("key")] so System.Text.Json maps them to the original JSON names — deserialise with JsonSerializer.Deserialize<Root>(json). Arrays become List<T>, decimals double, and nullable or optional values get ?. Using Newtonsoft.Json instead? Replace the attribute with [JsonProperty("key")].

Everything runs in your browser — your code and data are never uploaded, so it is safe to paste private config files and API responses.

Frequently asked questions

Does it work with Newtonsoft.Json?

Yes — swap JsonPropertyName for JsonProperty from Newtonsoft.Json.

Why double and not decimal?

JSON numbers are floating point; use decimal manually for money.

Can I get records instead of classes?

Change “public class” to “public record class” — the properties work the same.

Found it useful? Share the JSON to C# Class:

Last updated 2026-11-21 · Built by Vinayak Agarwal · Part of Developer & Web (77 tools)