在Newtonsoft.Json中保留删除尾随零 [英] Preserve remove trailing zeros in Newtonsoft.Json

查看:124
本文介绍了在Newtonsoft.Json中保留删除尾随零的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的C#应用​​程序中的Newtonsoft.JsonConverter有问题. 我有带尾随零的十进制. 转换为json后-缺少零.

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

示例:

input (decimal): 1.99000
output (json): 1.99

我有自己的转换器,该转换器处理十进制值. 另外,我将FloatParseHandling配置为十进制.

I have my own converter, that handles decimal value. Also, I configured FloatParseHandling as decimal.

我该怎么做才能保留此过程?

What can I do to preserve this process?

推荐答案

这是Json.NET 10.0.1中引入的错误,并报告了

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

这篇关于在Newtonsoft.Json中保留删除尾随零的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆