我试图扩展这里给出的JSON.net示例 http://james.newtonking.com/projects/json/help/CustomCreationConverter.html
我有另一个派生自基类/接口的子类
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(),
};
Run Code Online (Sandbox Code Playgroud)
如何将Json反序列化回List <Person>
[
{
"Department": "Department1",
"JobTitle": "JobTitle1",
"FirstName": "FirstName1", …Run Code Online (Sandbox Code Playgroud)