{ } Schemato

JSON to C# record Converter

Paste a JSON sample, get production-ready C# record code. Runs entirely in your browser.

Runs locally in your browser. Nothing you paste is uploaded to a conversion API.
Report output issue
Examples:

Typical user object from a /me API response

InputJSON

Tip: paste one JSON value, a JSON array, or NDJSON samples to infer optional fields.

OutputC# record

About this converter

Generate immutable C# 9+ records that round-trip through System.Text.Json. Particularly useful for ASP.NET Core endpoints and integration code.

Why convert JSON to C# record

  • Generate C# records that play nicely with System.Text.Json.
  • Express immutable DTOs without the Get/Set ritual.
  • Use init-only properties to keep instances safe to share.

How to use

  1. Paste your JSON on the left panel, or pick one of the sample tabs above.
  2. The converter infers field names, optionality, and types automatically.
  3. Copy the generated C# record on the right and drop it straight into your codebase.

Common pitfalls

  • Inferred types only see the payload you pasted. Add nullable / optional flags for fields that can be missing.
  • Numeric types are inferred as integer or float based on the sample. Real APIs sometimes return both — widen to a number/float type when in doubt.
  • Empty arrays default to an `unknown` element type. Paste a non-empty sample to get a meaningful element type.

FAQ

Is this json to c# record converter free?
Yes. It is fully free, no signup, and runs entirely in your browser. We do not store your input.
Does it work with nested objects and arrays?
Yes. Nested objects produce separate named types, and arrays infer the element type from the first non-null sample.
What about optional / nullable fields?
Fields whose value is null in the sample (or marked optional in JSON Schema / Prisma / GraphQL) are marked optional/nullable in the output. For real APIs, you may want to widen optionality manually after generation.
Can I generate C# Record from multiple JSON samples?
Today the tool processes a single sample. For more aggressive inference across multiple shapes, run the converter on the union/merge of your samples or open an issue.
Is the source code available?
Yes — the entire project is open source. See the GitHub link in the footer.

Next steps with C# record

Once you have the generated code, here are the most common ways to use it in a real project.

Use System.Text.Json

JsonSerializer.Deserialize<User>(json) handles records out of the box (since .NET 5+).

Wire into ASP.NET Core

Records work as parameters in [HttpPost] handlers; the framework deserializes automatically.

Related converters