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
@Test public void testNumber() { NumberTest test = new NumberTest(); test.setNum(10L); test.setTime(new Date()); test.setDecimal(new BigDecimal("0.02")); JSONObject jsonObject = (JSONObject) JSON.toJSON(test); assert Long.class == jsonObject.get("num").getClass(); assert Date.class == jsonObject.get("time").getClass(); assert BigDecimal.class == jsonObject.get("decimal").getClass(); } static class NumberTest { private Long num; private Date time; private BigDecimal decimal; public Long getNum() { return num; } public void setNum(Long num) { this.num = num; } public Date getTime() { return time; } public void setTime(Date time) { this.time = time; } public BigDecimal getDecimal() { return decimal; } public void setDecimal(BigDecimal decimal) { this.decimal = decimal; } }
请填写以下信息:
以上代码使用 Fastjson 1.2.83可以通过测试用例 使用Fastjson 2.0.49无法通过测试用例 经查是因为转换为JSONObject对象时,类型发生了变化
测试用例能够通过 下图为Fastjson 1.2.83测试结果
The text was updated successfully, but these errors were encountered:
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.50-SNAPSHOT/ 已经支持,请帮忙用2.0.50-SNAPSHOT版本验证
Sorry, something went wrong.
fix 1.x compatible api JSON#toJSON, for issue #2447
cf69590
https://github.com/alibaba/fastjson2/releases/tag/2.0.50 2.0.50已发布,请用新版本
No branches or pull requests
问题描述
环境信息
请填写以下信息:
重现步骤
以上代码使用 Fastjson 1.2.83可以通过测试用例
使用Fastjson 2.0.49无法通过测试用例
经查是因为转换为JSONObject对象时,类型发生了变化
期待的正确结果
测试用例能够通过
下图为Fastjson 1.2.83测试结果
The text was updated successfully, but these errors were encountered: