fastjson2 icon indicating copy to clipboard operation
fastjson2 copied to clipboard

[QUESTION] 如何配置 JSON.toJSONString 输出用空格代替制表符

Open junlongzzz opened this issue 1 year ago • 2 comments

目前使用 JSON.toJSONString(manifestJson, JSONWriter.Feature.PrettyFormat) 进行json字符串输出时,每行前方是制表符占位,如何能配置使用空格代替制表符,同时配置还可以指定几个空格,比如2个或4个。

junlongzzz avatar Oct 07 '23 09:10 junlongzzz

这样的目的是为了啥?

yanxutao89 avatar Nov 10 '23 08:11 yanxutao89

每个人的习惯是不一样的,就像我更喜欢每个 : 的后面都能有一个空格(VSCode 的格式化):

{
    "timestamp": 1701139494615,
    "dateDesc": "2023-11-28_10:44:54"
}

所以哪位大佬知道 fastjson2 要怎么配置才能在 : 后面有个空格?

mizhoux avatar Nov 28 '23 06:11 mizhoux