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]同时设置JSONField与JsonProperty,转字符串和字符串转对象结果不同 #2649

Closed
wbings opened this issue May 31, 2024 · 1 comment
Labels
bug Something isn't working fixed
Milestone

Comments

@wbings
Copy link

wbings commented May 31, 2024

问题描述

同时设置JSONField与JsonProperty,转字符串和字符串转对象结果不同

环境信息

请填写以下信息:

  • JDK信息:17.0.10
  • 版本信息:Fastjson2 2.0.46

重现步骤

@Data
public static class Node {
    @JSONField(name = "strValue")
    @JsonProperty("str_value")
    private String strValue;
}
public static void main(String[] args) {
    Node node = new Node();
    node.strValue = "hello world";
    String s = JSON.toJSONString(node);
    System.out.println(s);
    Node node1 = JSON.to(Node.class, s);
    System.out.println(node1);
}
@wbings wbings added the bug Something isn't working label May 31, 2024
@wbings wbings changed the title [BUG] [BUG]同时设置JSONField与JsonProperty,转字符串和字符串转对象结果不同 May 31, 2024
@wenshao wenshao added this to the 2.0.51 milestone May 31, 2024
@wenshao wenshao added the fixed label May 31, 2024
@wenshao
Copy link
Member

wenshao commented Jun 1, 2024

https://github.com/alibaba/fastjson2/releases/tag/2.0.51
问题已修复,请用新版本

@wenshao wenshao closed this as completed Jun 1, 2024
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