JSON to C# Converter

Convert JSON into serializer-ready C# records and classes without uploading your payload.

Raw JSON

Object, array, or primitive · 1 MB max

Valid JSON17 lines · 288 / 1,000,000 bytes

Code output

Inferred from the current JSON shape

#nullable enable

using System.Collections.Generic;
using System.Text.Json.Serialization;

public sealed record Root
{
    [JsonPropertyName("id")]
    public long Id { get; set; }
    [JsonPropertyName("project_name")]
    public string ProjectName { get; set; } = string.Empty;
    [JsonPropertyName("active")]
    public bool Active { get; set; }
    [JsonPropertyName("owner")]
    public OwnerItem Owner { get; set; } = new();
    [JsonPropertyName("tags")]
    public List<string> Tags { get; set; } = new();
    [JsonPropertyName("releases")]
    public List<Release> Releases { get; set; } = new();
}

public sealed record OwnerItem
{
    [JsonPropertyName("name")]
    public string Name { get; set; } = string.Empty;
    [JsonPropertyName("email")]
    public string Email { get; set; } = string.Empty;
}

public sealed record Release
{
    [JsonPropertyName("version")]
    public string Version { get; set; } = string.Empty;
    [JsonPropertyName("stable")]
    public bool Stable { get; set; }
    [JsonPropertyName("downloads")]
    public long Downloads { get; set; }
}
38 linesDebounced conversion · local only

Tool documentation

Convert JSON to C# records and classes

Generate clean C# models from representative JSON in seconds. DevCrate infers nested records, nullable values, collections, and System.Text.Json property mappings entirely inside your browser.

100% Client-Side

Conversion runs locally in your browser.

No Payload Logging

Your tool input is never uploaded or logged.

Private by Design

Input stays on your device and is not persisted.

How to use

  1. 1

    Paste representative JSON

    Add a JSON object or array to the left editor. The converter validates and processes the sample as you type.

  2. 2

    Review the generated C# model

    The C# target is selected automatically on this page. Nested objects, arrays, nullable values, and property names are inferred locally.

  3. 3

    Copy or download the result

    Use Copy output for your clipboard or Download file to save the generated model as a .cs file.

Technical details

C# records vs. classes

DevCrate emits sealed C# records with settable properties. Records provide value-based equality and with-expression support, while traditional classes use reference equality by default. The generated get; set; properties remain serializer-friendly and can be moved to a class declaration if your project requires class semantics.

Type inference

JSON integers become long, decimal numbers become double, booleans become bool, arrays become List<T>, and nested objects become named records. Nullable or missing fields receive nullable C# types where the representative data makes that state visible.

System.Text.Json compatibility

Generated JsonPropertyName attributes preserve original JSON keys, including snake_case names, while C# properties use PascalCase. The output enables nullable reference types with #nullable enable.

Representative-sample limitations

Generated types describe the JSON sample you provide, not every response an API could return. Review optional fields and mixed-type arrays against your API contract before using the model in production.

Privacy & security verification

DevCrate uses the browser's native parser and local JavaScript generation logic. The tool makes no processing API request, stores no payload on a server, and creates no server-side log of your input. Ordinary static page requests may still be logged by the site host, but they never contain your tool input.