alibaba / fastjson2

🚄 FASTJSON2 is a Java JSON library with excellent performance.
Apache License 2.0
3.69k stars 478 forks source link

[BUG] 千分符表示的字符串转long失败 #2461

Closed wenl001 closed 4 months ago

wenl001 commented 5 months ago

问题描述

科学计数法字符串转long失败,fastjson可以

环境信息

请填写以下信息:

重现步骤

如何操作可以重现该问题:

1、字符串: String channelRespBody="{\"openTime\":\"1,659,597,865\",\"startTime\":1712903332573 }"; 2、待转类型: private Long openTime;

期待的正确结果

openTime = 1,659597865

相关日志输出

请复制并粘贴任何相关的日志输出。 Exception in thread "main" com.alibaba.fastjson2.JSONException: parseLong error, value : 1,659,597,865 at com.alibaba.fastjson2.JSONReader.toInt64(JSONReader.java:3133) at com.alibaba.fastjson2.JSONReader.getInt64(JSONReader.java:984) at com.alibaba.fastjson2.JSONReaderUTF16.readInt64(JSONReaderUTF16.java:3144) at com.alibaba.fastjson2.reader.ORG_1_22_EeCheckIbanBo.readObject(Unknown Source) at com.alibaba.fastjson2.JSON.parseObject(JSON.java:726) at com.kucoin.wallet.chaincommon.pay.test.TestFastjson.main(TestFastjson.java:52)

附加信息

如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。

wenshao commented 5 months ago

https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.50-SNAPSHOT/ 问题已修复,请帮忙用2.0.50-SNAPSHOT版本验证

wenshao commented 4 months ago

https://github.com/alibaba/fastjson2/releases/tag/2.0.50 2.0.50已发布,请用新版本