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

来源:互联网 发布:js splice 参数 编辑:程序博客网 时间:2024/06/14 08:54


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},", ":\"\"},"));
0 0