JSON to C#
Paste a JSON response and get C# classes or records. Fields the payload can omit or send as null are annotated nullable, so the compiler warns you before a NullReferenceException does.
Output appears here as you type.
Runs entirely in your browser. Nothing you paste here is uploaded or stored.
Questions
Is my JSON uploaded anywhere?
No. Inference and code generation run entirely in your browser. Nothing is sent to a server, so pasting a real API response with customer data or internal URLs is safe.
Should I paste one object or an array of them?
An array, whenever you have one. Every element is merged into a single shape, so a field that is missing from some records becomes optional and a field that is sometimes null becomes nullable. One object can only ever tell the generator that everything is required.
Why does this produce different types than other converters?
Because every element of the array is merged before anything is generated. A converter that reads only the first record cannot know that a field is missing from later ones, or that it is sometimes null, so it emits a plain non-nullable type. In a statically typed language that is not a cosmetic difference: it is the line between a clean decode and a nil dereference at runtime.
Which serializer are the attributes for?
System.Text.Json by default, which is what modern .NET uses; switch to Newtonsoft if the project is on Json.NET, or turn attributes off entirely. The attribute preserves the original JSON key so the property can follow C# naming without breaking deserialisation.
What does "nullable reference types" change?
It emits string? rather than string for fields the payload can send as null. Without it the field still receives null at runtime - the compiler just stops warning you, which is how the exception ends up in production instead of in your editor.
Why was one of my properties renamed?
C# does not allow a member with the same name as its enclosing type, so a payload like {"user": {"user": ...}} would not compile. That property gets a suffix, and the serializer attribute still points at the original key.
More code generation tools
JSON → TypeScript
Generate named interfaces, with optionals and nullability inferred from every sample.
JSON → Zod
Generate a Zod schema, with formats, enums and optionals already applied.
JSON → JSON Schema
Generate a draft 2020-12 or draft-07 schema with $defs and required arrays.
JSON → Go
Generate Go structs with json tags, pointers for optional fields, and gofmt spacing.
JSON → Python
Generate Pydantic models or dataclasses, with aliases and correct field ordering.