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

JSONField 1.x 升级到2.x 命名规则失效 #4528

Open
QQQJoker opened this issue Aug 22, 2024 · 0 comments
Open

JSONField 1.x 升级到2.x 命名规则失效 #4528

QQQJoker opened this issue Aug 22, 2024 · 0 comments

Comments

@QQQJoker
Copy link

@JSONField(name = "companyName")
private String companyName;

   SerializeConfig config = new SerializeConfig();
    config.propertyNamingStrategy = PropertyNamingStrategy.SnakeCase;
    config.put(User.class, new CustomSerializer());
    User user = new User();
    user.setCompanyName("123");
    Object json = JSON.toJSON(user,config);
    System.out.println("json = " + json);

定义了全局使用下划线,个别字段使用驼峰,2.x不生效 1.x版本是生效的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant