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
#1258 在fastjson中有问题,fastjson2结果正常
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.annotation.JSONField; import lombok.Data; import lombok.Getter; import lombok.Setter; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; public class Issue1258Mutated_31 { @Getter @Setter @Data private class MutatedSimpleBean { @JSONField(name = "E") private Long et; } @Getter @Setter @Data private class MutatedSimpleBean1 { @com.alibaba.fastjson.annotation.JSONField(name = "E") private Long et; } @Test public void testMutated() { String str = "{\"E\":123,\"e\":\"abc\"}"; MutatedSimpleBean bean = JSON.parseObject(str, MutatedSimpleBean.class); assertEquals(123L, bean.et); } @Test public void testMutatedfj() { String str = "{\"E\":123,\"e\":\"abc\"}"; MutatedSimpleBean1 bean1 = com.alibaba.fastjson.JSON.parseObject(str, MutatedSimpleBean1.class); assertEquals(123L, bean1.et); } public static class MutatedBean { private Long et; public MutatedBean(@JSONField(name = "E") Long et) { this.et = et; } } public static class MutatedBean1 { private Long et; public MutatedBean1(@com.alibaba.fastjson.annotation.JSONField(name = "E") Long et) { this.et = et; } } @Test public void test2Mutated() { String str = "{\"E\":123,\"e\":\"abc\"}"; MutatedBean bean = JSON.parseObject(str, MutatedBean.class); assertEquals(123L, bean.et); } @Test public void test2Mutatedfj() { String str = "{\"E\":123,\"e\":\"abc\"}"; MutatedBean1 bean = com.alibaba.fastjson.JSON.parseObject(str, MutatedBean1.class); assertEquals(123L, bean.et); } }
能够正常解析
com.alibaba.fastjson.JSONException: parseLong error, value : abc at com.alibaba.fastjson.JSON.parseObject(JSON.java:525)
The text was updated successfully, but these errors were encountered:
support fastjson 1.x JSONField#name, for issue #2526
406134a
https://github.com/alibaba/fastjson2/releases/tag/2.0.50 2.0.50已发布,请用新版本
Sorry, something went wrong.
No branches or pull requests
问题描述
#1258 在fastjson中有问题,fastjson2结果正常
环境信息
重现步骤
期待的正确结果
能够正常解析
相关日志输出
com.alibaba.fastjson.JSONException: parseLong error, value : abc
at com.alibaba.fastjson.JSON.parseObject(JSON.java:525)
The text was updated successfully, but these errors were encountered: