[QUESTION]如何让fastjson2的PrettyFormat输出达到fastjson之前一样的效果?
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
### 如何让fastjson2的PrettyFormat输出达到fastjson之前一样的效果?
> FastJson2中格式化输出样式
`JSON.toJSONString(jsonObject, JSONWriter.Feature.PrettyFormat)`
```json
{
"type":1001,
"job_id":[
0,
45732
],
"id":[
1297059520,
4117498193
],
"is_client":false,
"stream_count":0
}
```
> FastJson中格式化输出样式
`JSON.toJSONString(jsonObject, Boolean.TRUE)`
```json
{
"type":1001,
"stream_count":0,
"job_id":[0,45732],
"id":[1297059520,4117498193],
"is_client":false
}
```
* 我该如何在fastjson2中做到fastjson之前的输出样式,不想让Json中数组的val展开换行
>因为项目有解析前后对比换行后样式错乱
Contributor guide
Research direction
Start with the JSON.toJSONString calls shown in the issue and inspect how JSONWriter.Feature.PrettyFormat formats array values. Compare that behavior with the older Boolean.TRUE output; done would mean fastjson2 can produce the requested inline-array formatting without disrupting other pretty-printed output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100