About this tool
The JSON to C# Classes tool converts a pasted JSON sample into C# model classes or records, so .NET developers can scaffold DTOs from an API response in seconds. It parses the JSON, infers C# types recursively, and emits one type per object: strings become string, ISO date-time strings DateTime, integers int or long, other numbers double, booleans bool, arrays List<T>, and nested objects their own PascalCase classes declared before the parents that reference them.
All parsing and code generation happen locally in your browser with JSON.parse and plain JavaScript — nothing is uploaded. Properties are emitted as PascalCase auto-properties, public T Prop { get; set; }. When the JSON key differs from the PascalCase property name the tool adds [JsonPropertyName("originalKey")] for System.Text.Json or [JsonProperty("originalKey")] for Newtonsoft, and only the required using directives are included.
Value-type properties that can be null in any sample are made nullable (int?, double?, bool?, DateTime?), while reference types like string and List are already nullable. The serializer toggle switches attribute and using style between System.Text.Json (default) and Newtonsoft.Json; the shape toggle emits either classes (default) or records. Copy the code or download it as a .cs file.