JSON to C# Classes
Generate C# classes from JSON for System.Text.Json or Newtonsoft.Json. Configure namespace, property casing, and nullable reference types.
Output will appear here…Generate C# classes from JSON
.NET has two main JSON libraries: System.Text.Json(the modern default in .NET 6 and later) andNewtonsoft.Json (the older, feature-rich alternative still common in legacy code). Lintify can generate classes for either — pick the library from the toolbar and the generator adds the right attributes to every property.
C# properties use PascalCase by convention, while JSON keys are usually camelCase. Lintify converts the casing and adds a [JsonPropertyName] attribute (for System.Text.Json) or [JsonProperty] (for Newtonsoft) so that the serializer still reads the original JSON key. This gives you idiomatic C# without losing the wire format.
Records vs classes
Records (introduced in C# 9) are the better default for JSON DTOs because they are immutable, have value-based equality, and require less boilerplate. PickRecord if you are on .NET 6 or later and your JSON consumer does not need to mutate the deserialized objects. Pick Class if you need mutability or if your serializer has trouble with records (rare in modern .NET).
Nullable reference types
When nullable reference types are enabled (the default in modern .NET projects), a field that can be null becomesstring? rather than string. JSONnull maps to C# null. Missing keys map to the default value of the property type, which for reference types is also null. The generated code is nullable-aware and will not produce warnings under the modern nullable reference types analyzer.
Number types
Integers become int (or longfor large values), decimals become double, and very large integers (over long.MaxValue) become long with a comment warning you that the value might overflow. For financial data, replacedouble with decimal after generation — double is not safe for money.decimal has more precision and is the right choice for currency.
Frequently asked questions
Common questions about the JSON → C# tool.