JsonSerializerSettings jss = new JsonSerializerSettings();
jss.NullValueHandling = NullValueHandling.Ignore;
string json = Newtonsoft.Json.JsonConvert.SerializeObject(obj, Formatting.Indented, jss);
Newtonsoft.Json 过滤空值 (空属性将不会生成相应的json 字符串)
最新推荐文章于 2024-09-13 09:42:31 发布