using System.Collections.Generic;
[JsonConverter(typeof(JsonSubtypes))]
[JsonSubtypes.KnownSubTypeWithProperty(typeof(Adult), "Name")]
[JsonSubtypes.KnownSubTypeWithProperty(typeof(Child), "Age")]
public class BaseHumanClass {
public int Id { get; set; }
public class Adult : BaseHumanClass {
public string Name { get; set;}
public class Child : BaseHumanClass {
public int Age { get; set; }
public static void Main()
Console.WriteLine("Hello World");
string json = "[{\"Id\":1,\"Name\":\"Dave\"},{\"Id\":2,\"Age\":64}]";
var humans = JsonConvert.DeserializeObject<ICollection<BaseHumanClass>>(json);
foreach (var human in humans) {
Console.WriteLine(human.GetType() + ": " + human.Id);