✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Prod p = new Car { Wheels = 4 };
var opt = new JsonSerializerOptions { TypeInfoResolver = new DefaultJsonTypeInfoResolver() };
string js = JsonSerializer.Serialize<Prod>(p, opt);
System.Console.WriteLine(js.Contains("Car"));
[JsonPolymorphic] [JsonDerivedType(typeof(Car))] abstract class Prod { }
class Car : Prod { public int Wheels { get; set; } }