Newtonsoft.Json serialization returns empty json object

后端 未结 4 1431
轻奢々
轻奢々 2020-12-25 10:09

I have list of objects of following class:

public class Catagory
{
    int catagoryId;
    string catagoryNameHindi;
    string catagoryNameEnglish;
    List         


        
4条回答
  •  梦谈多话
    2020-12-25 10:22

    Another cause of this problem--the class I was attempting to serialize derived from a base class that had the [DataContract] attribute, but the derived class lacked this attribute. Once I added [DataContract] to the derived class and [DataMember] to all of the public properties of the derived class it began working immediately.

提交回复
热议问题