alibaba / alibaba/fastjson2

解析json字符串时,取消unicode自动解码

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

Description

```
String json = "{\"message\": \"\\u4f60\\u597d\"}";
System.out.println(JSON.parse(json));
```
输出结果:{"message":"你好"}
期待的结果:{"message": "\u4f60\u597d"}

根据文档,[https://alibaba.github.io/fastjson2/features_cn.html](https://alibaba.github.io/fastjson2/features_cn.html)
JSONReader.Feature根本没有对应取消解码unicode的实现

我之前有提过,但您一直没有回复,可能是没有看到,所以我关闭了之前的[问题](https://github.com/alibaba/fastjson2/issues/2119),提出了这个问题。

Contributor guide

Open the contributing guide

Research direction

Start with the JSON.parse example and the JSONReader.Feature documentation linked in the issue. Investigate how escaped Unicode is handled during parsing and whether an existing feature controls that behavior. Done means a documented option can preserve the literal \u4f60\u597d sequence instead of decoding it to Chinese characters, with tests covering the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.