What it does
Paste a JSON document (an API response, a config file, a webhook payload) and get C# types you can paste straight into a .NET project. The output updates as you type.
Why it is better than “Paste JSON as Classes”
- Looks at every array item, not just the first. A property that is missing from some items, or
nullin some, becomes nullable (int?,string?), and a number that is1in one item and2.5in another becomesdouble. - Real type inference:
int, orlongwhen a value doesn’t fit;doubleordecimalfor fractions;bool;Guid;DateTimeOffsetfor timestamps with an offset orZ,DateTimewithout one,DateOnlyfor plain dates. Mixed values becomeJsonElement. - Identical shapes are generated once.
shippingAddressandbillingAddresswith the same properties share oneAddresstype. - Objects keyed by IDs (
{"1": {...}, "2": {...}}) becomeDictionary<string, T>. - Valid identifiers every time:
user_idbecomesUserId, names starting with a digit get a_prefix, C# keywords are escaped with@, and collisions with the class name or other properties are renamed. - System.Text.Json attributes only where needed. “Web defaults” assumes ASP.NET Core /
JsonSerializerOptions.Web(camelCase); “differs exactly” also covers the default, case-sensitiveJsonSerializer. - Modern C#: records with
initor classes withset, nullable reference types with safe initializers, optionalrequiredmembers, file-scoped namespace.
How to use it
Paste JSON or drop a .json file, set the root type name and namespace, then copy or download the .cs file. The status line shows the JsonSerializer.Deserialize<T> call to use.
Privacy
The conversion runs entirely in your browser. Your JSON is never uploaded; the last input is kept in local storage.