logo
GeekFormat

JSON zu C#

Online-Tool JSON zu C# konvertiert API-Antworten oder Konfigurations-JSON in standard C#-Klassen für ASP.NET Core, Unity, Blazor, .NET MAUI. Unterstützt [JsonProperty], List, Nullable<T>, verschachtelte Klassen, lokale Generierung.

Ähnliche Tools

About JSON to C#: Turning JSON data into compilable C# POCO classes

JSON to C# is the process of converting JSON-formatted data (objects or arrays) into C# class definitions (POCO, Plain Old CLR Object). C# is the primary language of the .NET ecosystem, widely used in ASP.NET Core backends, Unity games, .NET MAUI cross-platform apps, Blazor WebAssembly, desktop apps (WPF / WinForms), Azure cloud services, and more. Development often requires converting JSON samples from API docs or actual responses into C# types; writing classes manually is not only repetitive but also error-prone for field types and annotations. This tool aims to automate that process.

This tool runs locally in the browser based on quicktype-core, using the C# renderer to generate standard POCO class code. Default output includes using System.Collections.Generic; and [JsonProperty("original key")] annotations (Newtonsoft.Json compatibility mode), directly openable and compilable in Visual Studio. This means you receive not just a type draft but C# classes that can be placed into .NET projects and used with NuGet packages.

Type inference is at the core of JSON to C#. The tool maps JSON primitive types to .NET standard types: strings → string, integers → long, floats → double, booleans → bool, arrays → List<T>, nested objects → independent classes, null values → Nullable<T> (e.g., long? / bool? / string?). For nested objects, the tool automatically creates new classes for each level, named by capitalizing field names. For example, the address field generates an Address class, and objects in items arrays generate an Item class.

Integration with modern C# syntax: this tool defaults to generating serializable POCOs (public { get; set; } properties). For projects pursuing immutability, developers can change class to C# 9+ record types and change { get; set; } to init-only properties (public string Name { get; init; }), which with JsonSerializer.Deserialize<T>(jsonString) guarantees at compile time that data cannot be modified. This aligns with ASP.NET Core 7+ Minimal APIs and Entity Framework Core 8+ immutable entity design trends.

Unlike some online tools that require uploading JSON to servers, all computations in this tool happen in the browser. quicktype-core loads and executes via Web Worker; JSON parsing, type inference, C# code generation, and file downloads all occur locally with no data sent to any server. This is especially important for JSON containing API keys, user-private fields, or unreleased business structures; data is cleared from memory when the page is closed.

Note that auto-generated code is a starting point, not an endpoint. The tool infers types from JSON samples and cannot determine precise business types (e.g., URL, Email, ID and other semantic types are all inferred as string). For snake_case JSON fields, C# fields maintain PascalCase naming (user_name → UserName), but [JsonProperty("user_name")] annotations retain original keys for automatic mapping during deserialization. Treat generated results as a first draft, then fine-tune field names, types, and attributes according to project conventions.

Anwendungsfälle

  • ASP.NET Core Web API: Convert example JSON from OpenAPI / Swagger docs to DTO classes, receive frontend requests with [FromBody] model binding
  • ASP.NET Core MVC: Convert form/JSON request bodies to strongly-typed Models with automatic ModelState validation
  • Newtonsoft.Json deserialization: Convert third-party interface response JSON to POCO classes with [JsonProperty], no manual field mapping needed
  • System.Text.Json high-performance scenarios: Convert JSON to record types or init-only properties with JsonSerializer.Deserialize<T> for faster startup
  • Unity game scripts: Convert JSON returned by network APIs (player data, level config, shop items, leaderboards) to serializable ScriptableObject data models
  • .NET MAUI cross-platform apps: Convert backend API JSON to Model classes for XAML data binding, sharing business models across iOS / Android / Windows
  • Blazor Server / WebAssembly: Convert API JSON to strongly-typed component parameters / server models, consuming shared frontend-backend types with @inject HttpClient
  • Entity Framework Core: Convert JSON documents exported from databases to entity classes as reference base classes for EF Core model migrations, with [Key] / [Required] data annotations
  • Azure Functions / AWS Lambda: Convert Event Grid / SNS / API Gateway / Cosmos DB trigger event JSON to strongly-typed event parameters, simplifying serverless function signatures
  • SignalR real-time communication: Convert server-pushed JSON messages (chat, notifications, market data, IoT) to C# types for strongly-typed consumption in Hub methods
  • Microservice interface contracts: Convert inter-service RPC (gRPC-Web / HTTP / WCF) JSON request/response examples to C# classes as shared contract definitions across teams
  • Config file loading: Convert appsettings.json substructures to Options pattern classes (e.g., MyOptions : IOptions<MyOptions> with IConfiguration.Bind)
  • Test data preparation: Convert JSON fixtures to C# classes then deserialize with Newtonsoft / System.Text.Json for unit test driving, with xUnit / NUnit / MSTest
  • Web crawler data parsing: Convert JSON data scraped by HtmlAgilityPack / AngleSharp / PuppeteerSharp to C# classes, avoiding missing fields from dynamic JObject access
  • API documentation writing: Embed C# class examples as schema definitions in Swagger / OpenAPI docs, ReDoc, Knife4j, Swagger UI for better documentation readability
  • Code review collaboration: Convert API response JSON directly to readable POCOs for easier discussion of field naming, type selection, and annotation usage during Code Review
  • Legacy project refactoring: Refactor dynamic JObject / Dictionary<string, object> based access to strongly-typed POCO access, improving compile-time type checking and maintainability
  • Teaching & training: Convert sample JSON to POCO in C# courses / .NET introductory teaching to demonstrate object-oriented modeling, property accessors, and serialization principles

Anleitung

  1. Paste JSON content in the left editor, or click the upload button to select .json / .txt files, or click the example button to load built-in data
  2. Wait 400ms for auto-conversion; the right side shows generated C# POCO class code
  3. If JSON format errors occur, click the 'Fix JSON' button to auto-repair common syntax issues then reconvert
  4. Click the 'Copy' button to copy an individual class to the clipboard and paste into Visual Studio / Rider / VS Code, or click 'Download' to save as .cs file

Funktionen

  • Pure browser-local generation: JSON parsing and C# code generation all done in-browser via JavaScript + quicktype-core, input data never uploaded to any server
  • POCO + record dual modes: defaults to serializable POCO class, one-click switch to C# 9+ record types matching modern .NET coding style
  • Newtonsoft [JsonProperty] annotations: each field auto-generates [JsonProperty("original key")], compatible with Newtonsoft.Json default behavior; PascalCase field names don't affect deserialization
  • Automatic nested object splitting: JSON nested objects recursively generated as independent C# classes, named by capitalizing the field name (e.g., address → Address), avoiding type duplication
  • List generics auto-expansion: JSON arrays automatically converted to List<T>, T auto-inferred from first array element (["a","b"] → List<string>, [{...}] → List<Item>)
  • Nullable<T> auto-inference: JSON null value fields automatically marked as Nullable<T> (e.g., long? / string? / bool?), avoiding null reference exceptions at compile time
  • PascalCase field naming: snake_case input automatically converted to PascalCase (e.g., user_name → UserName), while [JsonProperty] annotations retain original keys for deserialization compatibility
  • Multiple value type mappings: string → string, integer → long, float → double, bool → bool, array → List<T>, null → Nullable<T>
  • Complete .cs template: generates standard C# files including using System.Collections.Generic; + namespace + public class + fields + properties, directly compilable
  • Copy & download: one-click copy of individual classes to clipboard, or download as .cs files directly dragged into Visual Studio / Rider / VS Code
  • One-click JSON error repair: automatically fixes common format errors like trailing commas, single quotes, missing quotes, continuing C# code generation after successful repair
  • Local history: auto-saves recent inputs based on localStorage, quickly recovers to continue editing after refresh or accidental page close

Codebeispiele

C#: Deserialize POCO generated by this tool using Newtonsoft.Json

csharp

Most common usage in ASP.NET Core projects: deserialize API responses using Newtonsoft.Json with POCOs generated by this tool.

using Newtonsoft.Json;
using System;
using System.Net.Http;
using System.Threading.Tasks;

public class ApiClient
{
    private static readonly HttpClient _http = new HttpClient();

    // POCO generated by this tool:
    public class User
    {
        [JsonProperty("id")]
        public long Id { get; set; }

        [JsonProperty("name")]
        public string Name { get; set; }

        [JsonProperty("email")]
        public string Email { get; set; }

        [JsonProperty("is_active")]
        public bool? IsActive { get; set; }
    }

    public static async Task<User> GetUserAsync(int userId)
    {
        // 1) Call API to get JSON string
        var json = await _http.GetStringAsync($"https://api.example.com/users/{userId}");

        // 2) Deserialize to POCO generated by this tool
        //    Internally maps snake_case JSON via [JsonProperty("id")] etc. annotations
        var user = JsonConvert.DeserializeObject<User>(json);

        Console.WriteLine($"User: {user.Name} ({user.Email})");
        return user;
    }
}

C#: ASP.NET Core Controller using POCO generated by this tool to receive requests

csharp

Place the User POCO generated by this tool in an ASP.NET Core Controller to automatically receive frontend JSON requests with [FromBody].

using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Linq;

// POCO generated by this tool (defaults to Newtonsoft [JsonProperty]):
public class CreateOrderRequest
{
    [Newtonsoft.Json.JsonProperty("user_id")]
    public long UserId { get; set; }

    [Newtonsoft.Json.JsonProperty("items")]
    public List<OrderItem> Items { get; set; }
}

public class OrderItem
{
    [Newtonsoft.Json.JsonProperty("product_id")]
    public long ProductId { get; set; }

    [Newtonsoft.Json.JsonProperty("quantity")]
    public long Quantity { get; set; }
}

[ApiController]
[Route("api/[controller]")]
public class OrdersController : ControllerBase
{
    [HttpPost]
    public IActionResult Create([FromBody] CreateOrderRequest request)
    {
        if (request == null || request.Items == null || !request.Items.Any())
        {
            return BadRequest("Items cannot be empty");
        }

        // Business logic: save order
        // var order = OrderService.Create(request);

        return Ok(new { order_id = 12345, status = "created" });
    }
}

/*
 * Corresponding .csproj dependencies:
 * <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.0" />
 * <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
 */

C#: Deserialization with HttpClient.GetFromJsonAsync + System.Text.Json

csharp

.NET 5+ / .NET 7+ recommended usage: using System.Text.Json built-in extension methods + record types with [JsonPropertyName] annotations.

using System.Net.Http.Json;
using System.Text.Json.Serialization;
using System.Threading.Tasks;

// This tool defaults to generating POCO class; manually change to record type below (immutable data carrier):
public record User
{
    [JsonPropertyName("id")]
    public long Id { get; init; }

    [JsonPropertyName("name")]
    public string Name { get; init; }

    [JsonPropertyName("email")]
    public string Email { get; init; }

    [JsonPropertyName("is_active")]
    public bool? IsActive { get; init; }
}

public class ApiClient
{
    private static readonly HttpClient _http = new HttpClient();

    public static async Task<User> GetUserAsync(int userId)
    {
        // System.Text.Json: GetFromJsonAsync accomplishes HTTP + deserialization in one line
        var user = await _http.GetFromJsonAsync<User>(
            $"https://api.example.com/users/{userId}");

        System.Console.WriteLine($"User: {user.Name} ({user.Email})");
        return user;
    }
}

/*
 * Corresponding .csproj dependencies (System.Text.Json is built-in, no extra installation needed):
 * <TargetFramework>net7.0</TargetFramework>
 *
 * If your project is .NET 7+ and you want to use [JsonProperty] compatible with Newtonsoft syntax,
 * add in Program.cs:
 *   builder.Services.AddControllers()
 *       .AddNewtonsoftJson(options =>
 *       {
 *           options.SerializerSettings.ContractResolver =
 *               new Newtonsoft.Json.Serialization.DefaultContractResolver();
 *       });
 */

Best Practices

Add <Nullable>enable</Nullable> in .csproj; nullable types like string? / List<User>? generated by this tool automatically get compile-time null checks, avoiding NullReferenceException runtime crashes.

This tool automatically converts JSON fields to PascalCase (e.g., user_name → UserName), while retaining the original key in [JsonProperty] annotations. This makes code conform to .NET official naming conventions while deserialization still works with original JSON keys.

When nesting exceeds 4 levels, recommend splitting the root object into multiple independent POCOs responsible for different business domains (e.g., UserDto / OrderDto / PaymentDto), avoiding one giant class containing all fields, improving maintainability.

Don't use POCOs generated by this tool as both EF Core Entities and API DTOs. Recommend: ① API layer uses DTOs (generated from JSON); ② EF Core layer uses Entities (manually add [Key] / [Required] etc. data annotations); ③ Do DTO ↔ Entity mapping via AutoMapper / Mapster. Avoid directly exposing database structure to frontend.

If your project uses System.Text.Json, recommend using IDE global replace to change generated [JsonProperty("xxx")] to [JsonPropertyName("xxx")]. Or keep original [JsonProperty] + install Microsoft.AspNetCore.Mvc.NewtonsoftJson package and call AddNewtonsoftJson() to support Newtonsoft syntax.

All calculations in this tool are done locally in the browser, but recommend adding another layer of protection in enterprise settings: ① Don't copy JSON containing production DB connection strings / API master keys to any online tool; ② For internal POCO generation, recommend NSwag or Visual Studio Paste JSON as Classes for completely offline generation; ③ Only use online tools with desensitized sample JSON.

JSON larger than 1MB renders slowly in browsers. Recommendations: ① Split into multiple independent POCO classes (e.g., User.cs / Address.cs / Order.cs) categorized by business module; ② For extra-large JSON Schema (100+ fields) use NSwag or Visual Studio built-in to directly generate; ③ Only use this tool for small-to-medium API responses (< 100 fields).

For DTOs / response models that don't need modification, recommend changing generated class to C# 9+ record and { get; set; } to { get; init; }. This: ① Guarantees data cannot be modified at compile time; ② Automatically gets value equality comparison (Equals / GetHashCode); ③ Simplifies object copying with with expressions.

Häufig gestellte Fragen

How do I convert JSON to C# classes?

Paste JSON content into the left input box; the tool automatically calls quicktype-core within 400ms to generate C# classes, with complete code displayed on the right. You can also click the 'Upload' button to select .json / .txt files, or click 'Example' to load built-in data. After generation, click the 'Copy' button to copy an individual class to the clipboard, or download as a .cs file.

Does the generated C# code include [JsonProperty] annotations?

Yes. The tool defaults to Newtonsoft.Json compatibility mode, automatically adding [JsonProperty("original key")] attributes for each field. This ensures that even if field names are converted to PascalCase, deserialization still correctly maps to the original JSON keys. If you use System.Text.Json, you can change [JsonProperty] to [JsonPropertyName] after generation (same semantics), or directly use System.Text.Json's default naming policy ([JsonPropertyName] in System.Text.Json can also be handled via custom JsonNamingPolicy).

Does it support generating POCO classes or record types?

By default it generates serializable POCO classes (with { get; set; } properties). If your project uses C# 9+ record types (immutable data carriers, suitable for DTOs / immutable models), you can manually change class to record after generation, and change { get; set; } to init-only properties (public string Name { get; init; }). Record types are widely used in ASP.NET Core 7+ Minimal APIs and Entity Framework Core.

What JSON data structures are supported?

All valid JSON structures are supported: basic types (null, boolean, number, string), arrays (1D or multi-dimensional), nested objects (any depth). Root input can be JSON object or JSON array; JSON objects generate public class Root, JSON arrays generate public class Root : List<Item>. JavaScript-specific values (functions, Symbols, undefined, Date objects, etc.) are not supported.

How do JSON field types map to C# types?

String → string, integer → long, float → double, boolean → bool, array → List<T>, nested object → independent class, null value fields → Nullable<T> (e.g., long? / bool? / string?). See the 'JSON Type to C# Type Mapping Quick Reference' table at the bottom of the page for detailed mapping rules.

Are null fields automatically generated as Nullable<T>?

Yes. The tool detects fields that are explicitly null or missing in JSON, automatically generating them as Nullable<T> form (e.g., long? Id { get; set; }). This is consistent with the Nullable Reference Types (NRT) feature introduced in C# 8, enabling the compiler to help you discover null reference risks during static analysis. Note: if you have NRT enabled, reference types default to non-nullable; you need to explicitly write string? to indicate nullability.

Do arrays convert to List<T>?

Yes. JSON arrays are uniformly converted to C# List<T>, with element types auto-inferred from the first array element. String arrays → List<string>, integer arrays → List<long>, object arrays → List<Item>. Empty arrays [] default to List<object> because element type cannot be inferred; it's recommended to manually change to a concrete type after generation (e.g., List<MyClass>). If you prefer T[] array syntax, use IDE Find & Replace to batch replace after generation.

How are nested objects handled?

The tool generates an independent C# class for each nested object. Naming convention capitalizes the field name (e.g., address → Address). If the root object contains an items array whose elements are objects, it generates a public class Item class, then referenced by public List<Item> Items { get; set; }. Objects with the same structure reuse the same type to avoid duplicate definitions.

Can I customize generated class names and namespaces?

Yes. quicktype-core defaults to using the JSON source name (e.g., Root) as the root class name. You can manually modify class names, namespace, and all references after generation. Downloaded .cs filenames can also be renamed as needed when saving (e.g., User.cs, Order.cs).

Can generated code be used directly in .NET projects?

Yes, directly usable. Generated files are standard C# syntax including using System.Collections.Generic; references. Place .cs files in the root or subdirectory of your .NET project; no additional dependencies are needed in .csproj (System.Text.Json is built into .NET; Newtonsoft.Json requires NuGet installation of Microsoft.AspNetCore.Mvc.NewtonsoftJson or Newtonsoft.Json package). Then you can deserialize with JsonConvert.DeserializeObject<T>(jsonString) or JsonSerializer.Deserialize<T>(jsonString).

Is data uploaded to servers?

Fully local browser operation. All JSON parsing, C# code generation, and file downloads are done in-browser via JavaScript + WebAssembly. Neither your input JSON data nor generated C# code are uploaded to any server, nor are they logged or cached in the cloud. Sensitive JSON containing API keys, tokens, or undisclosed business fields can be used safely; data is cleared when the page is closed.

Do I need to register or log in?

No. The tool is completely free, no registration, login, or authorization required. Just open the page and use it. All features are available locally in the browser.

What if JSON format is invalid?

The tool automatically checks JSON validity. On error, a red error message appears on the right with a 'Fix JSON' button. Clicking it auto-repairs common errors: trailing commas, single quotes replaced with double quotes, missing quotes on keys completed, comments removed, etc. After successful repair, C# code generation continues.

Which is better, Newtonsoft.Json or System.Text.Json?

Both are the most mainstream JSON libraries in the .NET ecosystem. Newtonsoft.Json (also known as Json.NET) is the oldest, most ecosystem-rich library compatible with almost all .NET projects; System.Text.Json is the high-performance library built into .NET Core 3.0+, faster startup, less memory, AOT-friendly. ASP.NET Core 3.0+ defaults to System.Text.Json; legacy .NET Framework projects and many third-party libraries rely on Newtonsoft.Json by default. This tool defaults to generating [JsonProperty] compatible with both (System.Text.Json in .NET 7+ also supports Newtonsoft compatibility via Microsoft.AspNetCore.Mvc.NewtonsoftJson).

What's the difference from JSON to Java, JSON to Rust?

All three convert JSON to target language type definitions, but output forms differ: JSON to C# generates POCO classes with [JsonProperty] annotations that can be directly deserialized with Newtonsoft.Json or System.Text.Json; JSON to Java generates POJOs with Lombok/Gson/Jackson annotations; JSON to Rust generates structs with Serde derive. Each focuses on different ecosystems; choose based on your tech stack.

What to do when deserializing classes with DateTime fields fails?

System.Text.Json doesn't support automatic string-to-DateTime conversion by default and throws JsonException. Two solutions: ① Add [JsonConverter(typeof(DateTimeConverter))] custom converter on the field; ② Configure global JsonSerializerOptions in Program.cs: options.PropertyNameCaseInsensitive = true; and handle DateTime via custom JsonConverter. Newtonsoft.Json supports DateTime deserialization by default, but special formats (like Unix timestamps) also require custom converters.

Why don't generated classes have namespace?

The tool doesn't generate namespace by default to maintain maximum compatibility for code snippets, making it easy for users to copy into any project. If you need namespace, manually add namespace YourApp.Models; at the top of generated code and place classes in corresponding .cs files. In .NET projects, organizing namespaces by functional module (Models / Dtos / ViewModels / Entities) is recommended.

Can I paste as classes directly in Visual Studio?

Visual Studio 2019+ has built-in 'Paste Special → Paste JSON as Classes' feature (Edit menu → Paste Special), which can directly convert JSON to C# classes. Code generated by this tool is compatible with that feature: copy C# code generated by the tool to clipboard, then paste into any .cs file for use. If you prefer the VS built-in feature, you can directly use Edit → Paste Special → Paste JSON as Classes without opening this tool.

Fehlerbehebung

Prompt 'Please enter JSON data' or right side is empty

The left input box is empty or contains only whitespace. Ensure valid JSON content is pasted, or click the upload button to select a .json / .txt file; you can also click the example button to load built-in samples.

Prompt JSON parsing failed

Common causes: trailing commas (e.g., {"a":1,}), using single quotes instead of double quotes, unquoted keys, containing JavaScript comments. Click the 'Fix JSON' button to auto-repair some errors; if it still fails, validate with a JSON formatting tool first.

Generated field types not precise enough

The tool infers types from JSON samples; for example all integers are long and all strings are string. If you need more precise types like int / decimal / Guid / DateTime, manually modify field types after generation. Note System.Text.Json doesn't support DateTime by default; [JsonConverter] customization is needed.

null fields generated as Nullable<T> but project hasn't enabled Nullable Reference Types

The tool defaults to generating in C# 8+ Nullable Reference Types form (e.g., string? / List<User>?). If your project is an older .NET Framework version / NRT not enabled, all reference types default to nullable; the ? in string? can simply be deleted (or enable <Nullable>enable</Nullable> in .csproj).

Compile error missing Newtonsoft.Json dependency

Add the following PackageReference in .csproj: <ItemGroup> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> </ItemGroup> Then run dotnet restore; NuGet downloads automatically. If using System.Text.Json no installation is needed (.NET built-in).

snake_case JSON fields inconsistent with PascalCase field naming

The tool automatically converts JSON field names to PascalCase (e.g., user_name → UserName), while retaining the original key in [JsonProperty] annotations. Newtonsoft.Json deserializes according to [JsonProperty] mappings without manual handling. If using System.Text.Json default naming policy, you need to change [JsonProperty] to [JsonPropertyName], or configure CamelCase naming policy in Program.cs.

Downloaded .cs file causes compile errors in project

Possible causes: ① Newtonsoft.Json / System.Text.Json dependency not added in .csproj; ② Classes placed in non-standard directories (should be placed in .NET project root or subdirectory with corresponding namespace); ③ Class names conflict with other types in the project. Solutions: add dependencies, adjust directories and namespaces, rename conflicting classes.

ASP.NET Core receiving JSON reports 'Cannot deserialize'

ASP.NET Core 3.0+ defaults to System.Text.Json, but [JsonProperty] generated by the tool is Newtonsoft.Json syntax. Two solutions: ① Add Microsoft.AspNetCore.Mvc.NewtonsoftJson package in .csproj and call AddNewtonsoftJson() in Program.cs; ② Change all generated [JsonProperty("xxx")] to [JsonPropertyName("xxx")] (System.Text.Json syntax).

Array is numeric type but generates List<object>

Usually happens when array is empty [] and defaults to List<object>. Add at least one sample element in source JSON (e.g., [1,2,3]); tool infers type from first element; or manually change List<object> to List<long> / List<int> after generation.

Page lag during large JSON conversion

Recommend splitting JSON into multiple independent modules for separate conversion, or only extract the portion that needs modeling. Browsers consume significant memory rendering many nested classes; JSON over 5MB recommends NSwag / Visual Studio built-in 'Paste JSON as Classes' for processing.

Glossar

POCO (Plain Old CLR Object)
Abbreviation for 'Plain Old CLR Object' in C# / .NET, constrained to: public default constructor + private fields + public { get; set; } properties + no framework dependencies. This tool generates standard POCOs.
record
Immutable data carrier type introduced in C# 9+, using value equality rather than reference equality. Can be manually changed to record after generation, suitable for DTOs, API response models, immutable configurations, etc.
[JsonProperty]
Newtonsoft.Json's field mapping attribute; this tool defaults to adding [JsonProperty("original key")] for each field, ensuring PascalCase field names correctly deserialize snake_case JSON.
Newtonsoft.Json
Also known as Json.NET, the most popular JSON library in the .NET ecosystem with the richest ecosystem and best compatibility, supported by almost all .NET projects. Default before ASP.NET Core 3.0; System.Text.Json became default after 3.0 but Newtonsoft remains compatible via NuGet packages.
System.Text.Json
High-performance JSON library built into .NET Core 3.0+, faster startup, less memory, AOT-friendly. Features include [JsonPropertyName] (corresponding to Newtonsoft's [JsonProperty]) and JsonNamingPolicy for custom naming strategies.
Nullable<T>
Form in C# for indicating nullable value types (e.g., long? / bool?). This tool auto-infers JSON null fields as Nullable<T>, helping avoid null reference exceptions at compile time.
List<T>
Generic list type in the .NET collections framework; this tool automatically converts JSON arrays to List<T>, with T auto-inferred from the first array element (e.g., ["a"] → List<string>).
namespace
Keyword in C# for organizing classes into namespaces, similar to Java's package. Code generated by this tool has no namespace by default; can be added manually (e.g., namespace MyApp.Models).
ASP.NET Core
Microsoft's open-source cross-platform web framework; POCO classes generated by this tool can be directly used for ASP.NET Core Controller [FromBody] model binding, Minimal APIs, Blazor component parameters, and more.
Unity
The world's most popular game engine, using C# as its scripting language. POCO classes generated by this tool can be used for Unity network API response parsing, ScriptableObject configuration data modeling.
Snake_case → PascalCase
Field naming strategy conversion, snake_case naming (e.g., user_name, created_at) converted to PascalCase naming (e.g., UserName, CreatedAt), conforming to .NET official naming conventions.
quicktype-core
The open-source multi-language JSON type generation library (quicktype project) this tool depends on, supporting over a dozen languages including C#, Java, TypeScript, Rust, Go, Swift, executing in-browser based on TypeScript + WebAssembly.
.NET MAUI
Microsoft's cross-platform UI framework (.NET Multi-platform App UI), C# code shared across iOS / Android / Windows / macOS. POCOs generated by this tool are suitable as Models for MAUI XAML data binding.
Blazor
Microsoft's WebAssembly-based SPA framework, in both Server and WebAssembly modes. C# classes generated by this tool can be used for Blazor component parameters, strongly-typed API response models, improving single-language full-stack development efficiency.
HttpClient.GetFromJsonAsync
.NET 5+ / System.Net.Http.Json extension method that accomplishes HTTP GET + JSON deserialization in one line. Combined with POCOs generated by this tool, greatly simplifies HTTP API client code.
JsonNamingPolicy
Class in System.Text.Json for controlling mapping strategy between JSON field names and C# property names (e.g., CamelCase, SnakeCaseLower). Newtonsoft.Json implements this via [JsonProperty] annotations or ContractResolver.
IOptions<T>
Core interface of the .NET Options pattern for binding appsettings.json substructures to strongly-typed classes. POCOs generated by this tool can directly serve as IOptions<T> implementations with IConfiguration.Bind.

JSON Type to C# Type Mapping Quick Reference

The tool automatically infers corresponding C# / .NET types based on JSON value types:

JSON Value ExampleGenerated C# TypeNullable FormNotes
nullInferred from contextT?null value fields automatically inferred as Nullable<T> (e.g., long? / bool? / string?)
true / falseboolbool?JSON booleans directly map to C# bool
42longlong?JSON integers default to long (64-bit integer, compatible with large numbers)
3.14doubledouble?JSON floats default to double (double-precision floating point)
"hello"stringstring?JSON strings map to C# string
["a","b"]List<string>List<string>?String arrays map to List<string>
[1,2,3]List<long>List<long>?Integer arrays map to List<long>
[{...},{...}]List<Item>List<Item>?Object arrays generate corresponding class from first element, then wrapped in List
[]List<object>List<object>?Empty arrays cannot infer element type, fall back to object; recommend changing to concrete type after generation
{...} nested objectIndependent classClassName?Nested objects generate independent classes, field names capitalized (address → Address)

Newtonsoft.Json vs System.Text.Json Annotation Comparison Table

Comparison of field mapping attributes between the two mainstream JSON libraries in the .NET ecosystem; this tool defaults to generating Newtonsoft-compatible [JsonProperty]:

Comparison ItemNewtonsoft.JsonSystem.Text.Json
Field mapping attribute[JsonProperty("user_name")][JsonPropertyName("user_name")]
Default naming policyKeeps PascalCase field names ([JsonProperty] needed for snake_case compatibility)Keeps original field names (matches by JSON key, CamelCase default)
Custom naming[JsonProperty] per-field specification[JsonPropertyName] + JsonNamingPolicy global configuration
Null handlingNullValueHandling.Ignore / IncludeJsonIgnoreCondition.WhenWritingNull
Default .NET version.NET Framework / .NET Core / .NET 5+.NET Core 3.0+ / .NET 5+
InstallationNuGet: Newtonsoft.JsonBuilt-in (no installation needed)
PerformanceMediumHigh (faster startup, less memory)
AOT supportRequires source generatorNative support
Suitable scenariosLegacy .NET projects, third-party library dependencies, rich ecosystemASP.NET Core 3.0+, high-performance scenarios, .NET MAUI / Blazor

Privacy & Security

Alle Operationen dieses JSON-zu-C#-Tools laufen vollständig in Ihrem Browser: JSON-Analyse, C#-Code-Generierung und Downloads werden clientseitig über JavaScript + WebAssembly (quicktype-core) ausgeführt. Keine JSON-Inhalte, hochgeladenen Dateien oder generierter Code werden über das Netzwerk gesendet. Uploads nutzen nativen FileReader direkt im Speicher. Kein Cookie-Tracking, keine Datenerhebung. Beim Schließen der Seite wird alles gelöscht.

Authoritative References