JSON to C#
Generate C# classes from JSON with [JsonPropertyName] attributes, nullable types and PascalCase properties for System.Text.Json.
JSON
C#
How the C# classes are built
- Properties use PascalCase with
[JsonPropertyName("…")]for the original key, forSystem.Text.Json(.NET 6 and newer). - Values that can be
nullor missing become nullable (int?,string?). Others get safe defaults like""andnew(). - Numbers too big for
intbecomelong. Mixed or unknown values becomeJsonElement?.
Deserialize
using System.Text.Json;
var data = JsonSerializer.Deserialize<Root>(json);
Console.WriteLine(data?.Title);Smart type detection
Objects inside arrays are merged into one type, so a key that appears in only some items is still included (as optional). Names come from the keys, and plural keys become singular: comments → Comment. Whole numbers and decimals in the same field become a decimal type. Everything runs in your browser; your JSON is never uploaded.
More free tools
JSON to TypeScriptGenerate TS interfaces from sample data.JSON to GoGo structs with json tags from sample JSON.JSON to PythonPydantic models or dataclasses from JSON.JSON to JavaJava records or POJOs with Jackson annotations.JSON to RustSerde structs from sample JSON.JSON ViewerTree view, search, copy path. Handles huge files.JSON FormatterBeautify or minify JSON in one click.JSON ValidatorClear errors with exact line and column.