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
简要描述您碰到的问题。 AutoType long类型解析成Integer,请看代码
请填写以下信息:
如何操作可以重现该问题: 执行代码
@Test public void testLong() { String str = "[300000000L]"; List list = JSONObject.parseObject(str, List.class, Feature.SupportAutoType); System.out.println(list.get(0).getClass());//print class java.lang.Integer Assert.assertTrue(list.get(0).getClass() == Long.class); }
正确解析成long类型
print class java.lang.Integer java.lang.AssertionError
建议修改的地方:com.alibaba.fastjson2.JSONReaderUTF16 的4038行
if (ch == 'L' || ch == 'F' || ch == 'D' || ch == 'B' || ch == 'S') { if (!intOverflow) {//这里改成 if (!intOverflow||ch == 'L' ) ,long类型不存在溢出的问题 switch (ch) { case 'B': valueType = JSON_TYPE_INT8; break; case 'S':
The text was updated successfully, but these errors were encountered:
fix autoType deserializer 'L' postfix not work, for issue #2608
04662d1
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.51-SNAPSHOT/ 问题已修复,请帮忙用2.0.51-SNAPSHOT版本验证
Sorry, something went wrong.
https://github.com/alibaba/fastjson2/releases/tag/2.0.51 问题已修复,请用新版本
No branches or pull requests
问题描述
简要描述您碰到的问题。
AutoType long类型解析成Integer,请看代码
环境信息
请填写以下信息:
重现步骤
如何操作可以重现该问题:
执行代码
期待的正确结果
正确解析成long类型
相关日志输出
print class java.lang.Integer
java.lang.AssertionError
附加信息
建议修改的地方:com.alibaba.fastjson2.JSONReaderUTF16 的4038行
The text was updated successfully, but these errors were encountered: