首页 > 解决方案 > 如何使用 Newtonsoft.Json 反序列化包含抽象类属性的对象

问题描述

我需要将 json 字符串转换为类型的对象FullArticleArticleBody(类中的 属性FullArticle)是一个抽象类。

如何将其反序列化为具体类?我知道 HtmlBody 已经实现了ArticleBody

public class FullArticle : ArticleListItem
{
    public string ShortDescription { get; set; }

    // ToDo Check this for removal
    public bool IsDone { get; private set; }

    public ArticleBody Body { get; }

    public long ViewCount { get; }
    public string Keywords { get; }
}

标签: c#json.net.net-corejson.net

解决方案


推荐阅读