C# classes from a JSON sample
Paste a response body and get public partial class declarations in a namespace, each property annotated with the JSON key it maps to. The classes are partial so you can add members in another file without touching the generated one.
Example
With Serializer on System.Text.Json and Output on Attributes only:
namespace QuickType
{
public partial class Customer
{
[JsonPropertyName("id")]
public long Id { get; set; }
[JsonPropertyName("orders")]
public Order[] Orders { get; set; }
}
public partial class Order
{
[JsonPropertyName("sku")]
public string Sku { get; set; }
[JsonPropertyName("gift")]
public bool? Gift { get; set; }
}
}
Gift is bool? because only some orders in the sample have it.
System.Text.Json or Newtonsoft
The two serializers differ in attribute names (JsonPropertyName against JsonProperty), in how enums and dates are converted, and in the helper code that Classes + converters emits. Pick the one your project already references; mixing them in one assembly is a common source of silent null properties.
Arrays switches collections between T[] and List<T>. Numbers switches fractional values between double and decimal; use decimal for money. Namespace sets the enclosing namespace, and Types only drops every attribute and helper for plain POCOs.
Limits
Union-typed fields have no direct C# equivalent, so the generator emits a small struct with one nullable member per type and a custom converter to fill it. Dates become DateTimeOffset when date inference is on. With C# 5 or 6 selected, nullable reference annotations are left out.