alibaba / alibaba/fastjson2

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

Open
#1,920 2 comments 1 reaction 0 assignees View on GitHub
question
Dominant language
Java
Stars
4.4k
Forks
613
Avg merge
1d 22h
Merged PRs (30d)
6

Description

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

Contributor guide

Open the contributing guide

Research direction

Start by inspecting JSON.toJSONString and JSONWriter.Feature.PrettyFormat in the fastjson2 source and documentation. Determine whether indentation can be configured, then document or expose a way to select spaces and their width; done when a 2- or 4-space output configuration is available and covered by an existing serialization test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.