-
Notifications
You must be signed in to change notification settings - Fork 479
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
[QUESTION]首字母为单个字母的驼峰转换问题 #607
Comments
现在的实现是参考java.beans.Introspector#decapitalize方法: package java.beans;
public class Introspector {
public static String decapitalize(String name) {
if (name == null || name.length() == 0) {
return name;
}
if (name.length() > 1 && Character.isUpperCase(name.charAt(1)) &&
Character.isUpperCase(name.charAt(0))){
return name;
}
char chars[] = name.toCharArray();
chars[0] = Character.toLowerCase(chars[0]);
return new String(chars);
}
} fastjson 1.x的实现,一直有人反馈说不对,希望和java.beans.Introspector#decapitalize方法一致,为了保证兼容一直没改。现在是2.0就改了。 下面分别是fastjson2、jackson、fastjson1、gson的结果,各不相同,如下:
你可以通过配置JSONField输出你要的,或者你用最新版本的2.0.13-SNAPSHOT版本,然后把field声明为public,比如: @Data
public class Bean1 {
public String pName;
} |
https://github.com/alibaba/fastjson2/releases/tag/2.0.13 |
Zaifa 我就拉黑你啦
| |
Zhr
|
|
***@***.***
|
…---- 回复的原邮件 ----
| 发件人 | ***@***.***> |
| 发送日期 | 2022年09月10日 15:55 |
| 收件人 | ***@***.***> |
| 抄送人 | ***@***.***> |
| 主题 | Re: [alibaba/fastjson2] [QUESTION]首字母为单个字母的驼峰转换问题 (Issue #607) |
https://github.com/alibaba/fastjson2/releases/tag/2.0.13
2.0.13版本已经发布,请用帮忙用新版本验证
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题补充:
The text was updated successfully, but these errors were encountered: