How to do Conditional Serialization using C# - NewtonSoft.Json

后端 未结 2 778
盖世英雄少女心
盖世英雄少女心 2021-01-16 20:33

I am doing json serialization using NewtonSoft.Json

public class CommonBase
{
    [JsonProperty(PropertyName = \"u_customer_id\")]
    public long CustomerId         


        
2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-16 21:24

    I have solved this issue by changing CustomerId property as nullable.

       public long? CustomerId { get; set; }
    

提交回复
热议问题