ToolHuts
JSON tools

JSON to C#

Generate C# classes for System.Text.Json from JSON samples or a supported JSON Schema. We merge every sample, map original JSON property names, and keep your data in your browser.

For multiple samples, put a line containing --- between complete JSON documents. Missing and nullable fields use nullable C# properties; null-only values use JsonElement. Mixed types use JsonElement.

We process your text in your browser without uploading or saving it.

What the output means

We generate classes with public properties and JsonPropertyName attributes. Missing or nullable fields use nullable properties; mixed types use JsonElement so you can inspect their kind. Nested objects get named classes. Numbers use double, which can round large integers. Empty arrays use JsonElement items; duplicate JSON keys keep their last value. Optional absent fields serialize as null by default; configure WhenWritingNull to omit them. Root arrays and primitive values use a wrapper class with a generated converter. Use .NET 8 or newer with nullable reference types. Generated declarations describe data shapes, not runtime validation.

Schema support

We support type (including nullable arrays of types), properties, required, items, primitive enum and const, and boolean additionalProperties. Enum and const infer C# value types, not literal-value restrictions. Additional properties use JsonExtensionData; additionalProperties false does not make the C# runtime reject unknown keys. False schemas, references and unsupported constraints produce an error. Choose JSON Schema for this structural subset. Unsupported constraints produce an error instead of silently disappearing. Required fields describe schema presence; C# deserialization does not enforce every schema constraint.

Why use this instead of a chat prompt?

Combine several real API responses, inspect one deterministic result, and download C# without sending samples to a chat service. We process your text locally and never upload your JSON.

Updated 25 November 2026 · Built by the ToolHuts team.

Explore JSON converters