Convert JSON to C#
class, record or
model. Instantly.
Generate C# classes, records and annotated models from any JSON. Plain class, System.Text.Json and Newtonsoft.Json styles. Nested objects, List<T> arrays, nullable types. Runs entirely in your browser.
object? — refine manually after generating.
Choose the style that matches your .NET version and JSON library.
| Style | Requirements | Best for |
|---|---|---|
| Plain class | Any .NET / .NET Framework | Maximum compatibility — works with any JSON library, any .NET version. Use as the base and add annotations manually. |
| C# Record | C# 9+ · .NET 5+ | Immutable API response models. Positional record syntax — concise, with built-in equality and ToString(). |
| System.Text.Json | .NET Core 3.0+ — no NuGet needed | Modern .NET 6/7/8/9 projects. [JsonPropertyName] maps snake_case keys. Fastest built-in option. |
| Newtonsoft.Json | NuGet: Newtonsoft.Json | Legacy .NET Framework, older ASP.NET Core, or projects already using Newtonsoft. [JsonProperty] attribute. |
Type inference rules applied to each JSON value.
| JSON value | C# type | Notes |
|---|---|---|
"Alice" | string | All JSON strings become string. |
42 | int / long | Values ≤ int.MaxValue become int, larger become long. |
98.5 | double | All floating-point numbers become double. |
true | bool | Direct mapping. |
null | object? | Null → nullable object. Refine the type manually after generating. |
["a","b"] | List<string> | Item type inferred from first element. Empty → List<object>. |
[{…},{…}] | List<ChildClass> | Array of objects → separate class + typed List. |
{…} | ChildClass | Nested object → separate named class in PascalCase. |
When consuming a third-party REST API in an ASP.NET Core application, you need a C# class for System.Text.Json or Newtonsoft to deserialise the response. Generate from the actual API response, choose your library style, and call JsonSerializer.Deserialize<T>(json) immediately.
Visual Studio has a built-in "Paste JSON As Classes" feature (Edit → Paste Special), but it only generates plain classes. This converter gives you the same result plus Record, System.Text.Json and Newtonsoft styles — directly in the browser without opening Visual Studio.
Blazor WebAssembly and .NET MAUI apps use System.Text.Json by default for HTTP responses. Generate the model class with STJ attributes to handle snake_case API keys automatically — without writing a custom JsonNamingPolicy.
Migrating a legacy .NET Framework project that uses Newtonsoft.Json? Generate Newtonsoft-annotated classes from the API response JSON — then switch to System.Text.Json by regenerating with the STJ style when you upgrade to .NET 6+.
C# classes generated
in your browser. No upload.
The entire class generation runs in JavaScript locally — your JSON API response is never transmitted to any server. The generated code follows C# conventions: PascalCase property names, correct nullable annotations, and the exact attribute syntax for each JSON library.
The output is immediately usable: add the namespace, paste into your Models folder, and call JsonSerializer.Deserialize<Root>(json). No additional configuration needed for standard JSON keys.
