Guide

THE TOOLBOX / DATA & CODE GENERATION

JSON to C# Converter —
C# Records & Classes, Java POJOs & Kotlin Data Classes.

Paste any nested JSON payload to instantly generate clean, strongly typed C# records or classes (with System.Text.Json attributes), Java records (Jackson), or Kotlin @Serializable data classes directly in your browser.

Generated CS Models
using System.Collections.Generic;
using System.Text.Json.Serialization;

public record OrderResponse(
    [property: JsonPropertyName("orderId")]
    string OrderId,
    [property: JsonPropertyName("createdAt")]
    string CreatedAt,
    [property: JsonPropertyName("isPaid")]
    bool IsPaid,
    [property: JsonPropertyName("totalAmount")]
    double TotalAmount,
    [property: JsonPropertyName("discountCode")]
    object? DiscountCode,
    [property: JsonPropertyName("customer")]
    Customer Customer,
    [property: JsonPropertyName("items")]
    List<Item> Items
);

public record Item(
    [property: JsonPropertyName("sku")]
    string Sku,
    [property: JsonPropertyName("quantity")]
    int Quantity,
    [property: JsonPropertyName("unitPrice")]
    double UnitPrice
);

public record Customer(
    [property: JsonPropertyName("id")]
    int Id,
    [property: JsonPropertyName("fullName")]
    string FullName,
    [property: JsonPropertyName("email")]
    string Email
);

STRONGLY TYPED DTO GENERATION GUIDE

Mapping JSON types cleanly into C#, Java, and Kotlin DTOs.

1. System.Text.Json & PascalCase Mapping

C# properties follow PascalCase while JSON APIs use camelCase or snake_case. Keeping [JsonPropertyName("...")] attributes guarantees exact serialization without custom naming policies.

Frequently Asked Questions

Should I generate C# records or C# classes from JSON?

For .NET 6+ APIs and immutable DTOs, C# records are concise and work seamlessly with System.Text.Json. Choose C# classes with { get; set; } properties if you need mutable entities, Entity Framework tracking, or older .NET Framework compatibility.

Does this JSON to C# converter handle nested objects and typed arrays?

Yes. It recursively walks nested JSON objects and arrays to emit strongly typed child classes or records, typed List<T> collections, int/long/double number inference, and nullable types for null fields.

Is my API JSON payload uploaded to a server?

No. Parsing and code generation run 100% locally in your browser—safe for internal API contracts, staging responses, and proprietary schemas.