Json serialization for Object Data Type

前端 未结 2 1013
礼貌的吻别
礼貌的吻别 2020-12-20 08:02
public class MyClass
{ 
    public object BidAutoObject { get; set; }
    public bool IsApplied { get; set; }
}

I have a class like above and I am

2条回答
  •  眼角桃花
    2020-12-20 08:34

    I guess what you are looking for is the TypeNameHandling in the JsonSerializerSettings which you need to add for de- and serialization. Just set it to TypeNameHandling.Auto which will add a type property to the json for instances which have a type not equal to the declared type.

提交回复
热议问题