如何在JSON.NET中实现自定义Json转换器以反序列化基类对象的列表?
public class Person{ public string FirstName { get; set; } public string LastName { get; set; }}public class Employee : Person{ public string Department { get; set; } public string JobTitle { get; set; }}public class Artist : Person{ public string Skill { get; set; }}List<Person> people = new List<Person>{ new Employee(), new Employee(), new Artist(),};
[ { "Department": "Department1", "JobTitle": "JobTitle1", "FirstName": "FirstName1", "LastName": "LastName1" }, { "Department": "Department2", "JobTitle": "JobTitle2", "FirstName": "FirstName2", "LastName": "LastName2" }, { "Skill": "Painter", "FirstName": "FirstName3", "LastName": "LastName3" }]