We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
框架中的日志模块在JSONStringer处理过程中如果是double或者float类型的数据,可能会导致看到的日志和实际返回的response有偏差,譬如服务器返回的是20.00,经过处理后会导致显示成20,可能是以下代码处理导致的
JSONStringer
this.out.append(JSONObject.numberToString((Number)value));
这里是否可以考虑优化一下展示最原始的服务器返回数据呢
The text was updated successfully, but these errors were encountered:
对的,JSONObject.numberToString(Number)方法内部会对数据自动抹0,即使不使用该方法,在字符串转JSONObject对象的时候,对于double类型数据,也只会保留1个0,如:20.0,所以,解决这个问题,就需要自己写一套json数据解析的框架,不值的,可以考虑非格式化数据,此时就会原样输出
JSONObject.numberToString(Number)
JSONObject
Sorry, something went wrong.
感谢大佬 也倒不是啥大问题,原因是同事说返回的数据中又小数位.00...我很自信的看日志中是整数位没有.00的...所以排查出这个点儿
No branches or pull requests
框架中的日志模块在
JSONStringer
处理过程中如果是double或者float类型的数据,可能会导致看到的日志和实际返回的response有偏差,譬如服务器返回的是20.00,经过处理后会导致显示成20,可能是以下代码处理导致的这里是否可以考虑优化一下展示最原始的服务器返回数据呢
The text was updated successfully, but these errors were encountered: