public class JSONFormatStyle extends Object
Modifier and Type | Field and Description |
---|---|
static JSONFormatStyle |
COMPACT
默认紧凑风格:
无换行
无缩进
',' 和 ':' 后无空格
|
static JSONFormatStyle |
PRETTY
默认格式化风格:
换行符:
"\n"
双空格缩进
',' 和 ':' 后加空格
|
Constructor and Description |
---|
JSONFormatStyle(String newline,
String indent,
boolean spaceAfterSeparators)
构造
|
Modifier and Type | Method and Description |
---|---|
String |
getIndent()
获取缩进符
|
String |
getNewline()
获取换行符
|
static JSONFormatStyle |
getStyle(int indentFactor)
获取格式化风格
|
boolean |
isSpaceAfterSeparators()
分隔符后是否加空格
|
public static final JSONFormatStyle COMPACT
','
和 ':'
后无空格public static final JSONFormatStyle PRETTY
"\n"
','
和 ':'
后加空格public static JSONFormatStyle getStyle(int indentFactor)
indentFactor
- 缩进因子,定义每一级别增加的缩进量public String getNewline()
public String getIndent()
public boolean isSpaceAfterSeparators()
Copyright © 2025. All rights reserved.