ASP.NET JsonConvert.SerializeObject排除NULL值的变量

JsonConvert.SerializeObject(model, new JsonSerializerSettings {
 NullValueHandling = NullValueHandling.Ignore 
})
未过滤null序列化结果
"memberquery": {
  "name": "test",
  "sex": "女",
  "phonenumber": Null
  "birthdate": Null
}


已过滤null序列化结果
"memberquery": {
  "name": "test",
  "sex": "女",
}

猜你喜欢

转载自blog.csdn.net/qq285679784/article/details/126895779