Skip to content
New issue

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

[BUG] #1246

Closed
skiray opened this issue Mar 16, 2023 · 5 comments
Closed

[BUG] #1246

skiray opened this issue Mar 16, 2023 · 5 comments
Labels
bug Something isn't working fixed
Milestone

Comments

@skiray
Copy link

skiray commented Mar 16, 2023

问题描述

源实体类属性值是大写,序列化的时候key变成了小写,1.x是正常的,2.x是小写;
并且属性名称是单个字母加数字如:P2,@JSONField(name="") 也不生效

环境信息

请填写以下信息:

  • OS信息: [e.g.:MacBook Pro (13-inch, M1, 2020)]
  • JDK信息: [e.g.:Openjdk 11.02]
  • 版本信息:[e.g.:Fastjson2 2.x.x]

重现步骤

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

  1. 使用 xxx.xxx 方法
  2. 输入 ... 数据
  3. 出现 ... 错误
//可在此输入示例代码

期待的正确结果

{"age":"22","name":"xiaom","aaa":"asda"}
{"age":"22","name":"xiaom","P2":"asda"}

相关日志输出

{"age":"22","name":"xiaom","p2":"asda"}

附加信息

image

image

换多字母名称可,好像跟getter、setter名称有关
image

@skiray skiray added the bug Something isn't working label Mar 16, 2023
@skiray
Copy link
Author

skiray commented Mar 16, 2023

image

@skiray
Copy link
Author

skiray commented Mar 16, 2023

1.x是正常的大写

@skiray
Copy link
Author

skiray commented Mar 16, 2023

image
当属性值是private时,transient 与JSONField均无效;应该是用了getter setter方法。
当属性值是public ,一切正常,看起来不是bug总感觉管怪怪的当private transient String xxx;

wenshao added a commit that referenced this issue Mar 16, 2023
@wenshao
Copy link
Member

wenshao commented Mar 16, 2023

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

@wenshao wenshao added this to the 2.0.26 milestone Mar 16, 2023
@wenshao wenshao added the fixed label Mar 16, 2023
@wenshao
Copy link
Member

wenshao commented Mar 19, 2023

@wenshao wenshao closed this as completed Mar 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

2 participants