Newtonsoft.Json 时间格式设置,替换null为""


Newtonsoft.Json.JsonSerializerSettings jSetting = new Newtonsoft.Json.JsonSerializerSettings();

jSetting.NullValueHandling = Newtonsoft.Json.NullValueHandling.Include;

 jSetting.DateFormatString = "yyyy-MM-dd HH:mm:ss";

 sbContent.Append(JsonConvert.SerializeObject(gameresult, jSetting).Replace(":null,", ":\"\",").Replace(":null},", ":\"\"},"));

猜你喜欢

转载自blog.csdn.net/leejin_521/article/details/43488349