Preserve remove trailing zeros in Newtonsoft.Json

前端 未结 2 569
深忆病人
深忆病人 2021-01-23 14:52

I have problem with Newtonsoft.JsonConverter in my C# app. I have decimal with trailing zeros. After convert to json - there zeros are missing.

Example:

相关标签:
2条回答
  • 2021-01-23 15:46

    Add this to your WebApiConfig.cs:

    config.Formatters.JsonFormatter.SerializerSettings.Converters.Add(
                    new IsoDateTimeConverter() { DateTimeFormat = "yyyy-MM-dd hh.mm.ss.fff" });
    
    0 讨论(0)
  • 2021-01-23 15:53

    This was a bug introduced in Json.NET 10.0.1 and reported here. It has since been fixed in 11.0.1.

    0 讨论(0)
提交回复
热议问题