Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSONArray转string时小数点为0的浮点数会丢失精度问题 #773

Closed
w-lay opened this issue Aug 12, 2016 · 2 comments
Closed

JSONArray转string时小数点为0的浮点数会丢失精度问题 #773

w-lay opened this issue Aug 12, 2016 · 2 comments
Milestone

Comments

@w-lay
Copy link

w-lay commented Aug 12, 2016

一些价格类数据 如22.0 10.0 作为json的value 用fastjson转换时会省略后面的.0 在一些应用场景会出现问题。

@wenshao
Copy link
Member

wenshao commented Aug 12, 2016

之前是故意去掉的,陆续有人反馈说有问题,你遇到的是具体什么问题?我好决定是否保留".0"

@w-lay
Copy link
Author

w-lay commented Aug 12, 2016

例如[{"price":22.0},{“price”:10.0}] JSONArray.toString() 结果会变为"[{"price":22},{“price”:10}]" 类似这样 .0 会被去掉,在一些使用场景会出现问题,比如需要用这个串做签名和验签,串会不一致

@wenshao wenshao added this to the 1.2.17 milestone Sep 5, 2016
@wenshao wenshao closed this as completed Sep 5, 2016
dopuskh3 pushed a commit to criteo-forks/fastjson that referenced this issue Apr 20, 2017
asa1997 pushed a commit to Be-Secure/fastjson that referenced this issue Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants