Paste JSON and get C# classes with [JsonProperty] attributes for Json.NET
Runs in your browser. Nothing you type is sent anywhere. Checked against sources on 16 Oct 2026.Projects on Json.NET read JSON with JsonConvert.DeserializeObject, and each property needs a [JsonProperty("key")] attribute when the C# name differs from the key. Paste a sample and get classes written for Newtonsoft.Json: PascalCase properties, the original key in every attribute, int, long or double per field, and nullable types wherever the sample shows null or leaves a key out.
Paste or type your input.
Choose the options you need.
Press Ctrl+Enter, then copy or download.
C# reads JSON into typed classes, and each property needs the right type and a way to find its key. This converter writes those classes from a sample, so a long API response becomes a compiling model in one paste.
| JSON value | C# type |
|---|---|
| "text" | string |
| true / false | bool |
| 42 (whole numbers only) | int, or long beyond 32 bits |
| 4.5 (any decimal seen) | double |
| null, and also a type | int?, string? |
| only null, or mixed kinds | object? |
| [ ... ] | List<...> |
| { } empty | Dictionary<string, object> |
| { ... } | a class of its own |
Keys and names. Properties are PascalCase, so user_name becomes UserName and avatar_url AvatarUrl. Every property carries its original key in an attribute, because System.Text.Json matches names case-sensitively unless told otherwise; Newtonsoft gets [JsonProperty] instead. A property that would share its class's name, which the compiler rejects as CS0542, gets Value added.
The rest of the article, and all 6 questions about JSON to C# Class Converter, are on the JSON to C# Class Converter page.
Paste a JSON sample into the converter and the C# classes appear beside it, one per object, with a JsonPropertyName attribute on every property. Copy them into your project and read the JSON with JsonSerializer.Deserialize<Root>(json), or JsonConvert.DeserializeObject<Root>(json) when Newtonsoft is chosen.
System.Text.Json matches property names case-sensitively by default, so a property called UserName would never receive the key user_name. The attribute names the exact key, which keeps C# naming in PascalCase and still reads the JSON without any serializer options or naming policy.
Records with init accessors suit models you only read, because their properties cannot change after deserialization and two records with the same values compare equal. Classes with set suit models you fill in or edit. Both work with System.Text.Json from .NET 5 and with Newtonsoft.Json.
Whole numbers become int, or long when a value is beyond 2,147,483,647, and a field becomes double as soon as any sample value has a decimal part. Values of different kinds, such as a number in one item and text in another, become object?, which keeps the raw JSON value.
Rates and rules change; check the source before you rely on a figure.
Still stuck? Ask about JSON to C# Class Converter and anybody who knows can answer. No account needed.
Same job, other tools: TSV to JSON – Convert tab-separated values, such as a paste from Excel, into JSON · JSON to YAML – Turn JSON into clean, readable YAML for configs · Query String Parser – Split a URL query string into a table of decoded parameters.