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

[新功能] JSONUtil 增加新封装 下划线转驼峰 驼峰转下划线 #3844

Open
jdAction opened this issue Jan 14, 2025 · 0 comments
Open

Comments

@jdAction
Copy link

版本情况

JDK版本: openjdk_17
hutool版本: 5.8.34

问题描述(包括截图)

需要增加 JSONUtil 从String转换为jsonObj时进行驼峰和下划线之间的相互转换,不是转换为bean,JSONConfig中也没有这种配置属性,希望增加

  1. 复现代码

`
import cn.hutool.json.JSONUtil;

public class Main {
public static void main(String[] args) {
String camelCaseStr = "{"userAge":"123"}";
String underScoreStr = JSONUtil.camelToUnderline(camelCaseStr);
System.out.println(underScoreStr); // 输出:user_age:123
}
}

import cn.hutool.json.JSONUtil;

public class Main {
public static void main(String[] args) {
String underScoreStr = "{"user_age":"123"}";
String camelCaseStr = JSONUtil.underlineToCamel(underScoreStr);
System.out.println(camelCaseStr); // 输出:userAge:123
}
}

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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy