mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
🐞修复JSONStrFormatter:format函数对于转义符号处理逻辑错误问题
This commit is contained in:
@@ -54,15 +54,18 @@ public class JSONStrFormatter {
|
||||
if (null == wrapChar) {
|
||||
//字符串模式开始
|
||||
wrapChar = key;
|
||||
} else if (isEscapeMode) {
|
||||
//在字符串模式下的转义
|
||||
isEscapeMode = false;
|
||||
} else if (wrapChar.equals(key)) {
|
||||
if (isEscapeMode) {
|
||||
//字符串模式下,遇到结束符号,也同时结束转义
|
||||
isEscapeMode = false;
|
||||
}
|
||||
|
||||
//字符串包装结束
|
||||
wrapChar = null;
|
||||
}
|
||||
|
||||
if ((i > 1) && (json.charAt(i - 1) == CharUtil.COLON)) {
|
||||
// 值前加空格
|
||||
result.append(CharUtil.SPACE);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user