87,910
社区成员
发帖
与我相关
我的任务
分享
public class Main {
public static void main(String[] args) {
String json = "{\"name\":\"value\"}";
String t = json.replaceAll("\"(\\w+)\"(\\s*:\\s*)", "$1$2");
System.out.println(t);
}
}
import java.util.regex.*;
public class Main {
public static void main(String[] args) {
String json = "{name:\"value\"}";
Pattern p = Pattern.compile("/\"(\\w+)\"(\\s*:/\\s*)");
Matcher m = p.matcher(json);
String t = m.replaceAll("$1$2");
System.out.println(t);
}
}