[BUG] fastjson2 兼容版本不能完全正确解析字符串
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
### 问题描述
fastjson2 兼容版本不能完全正确解析字符串
### 环境信息
- JDK信息: jdk 1.8.0_472
- 版本信息:Fastjson 2.0.60
### 重现步骤
*如何操作可以重现该问题:*
1. 使用 `JSONObject.parseObject()` 方法
2. 输入 `{19:2,29:1,39:3}` 数据
3. 字符串不能完全正确解析
```java
//部分关键代码
...
Map tabletopLevelMap = new HashMap<>();
JSONObject levelInfoMap = JSONObject.parseObject("{19:2,29:1,39:3}");
for (Map.Entry entry : levelInfoMap.entrySet()) {
tabletopLevelMap.put(Integer.parseInt(entry.getKey()), (Integer) entry.getValue());
}
...
int count = 0;
for (Map.Entry entry : tabletopLevelMap.entrySet()) {
if (entry.getValue() >= needLevel) {
count += 1;
}
}
return count;
...
```
Contributor guide
Research direction
Start with JSONObject.parseObject() and reproduce the issue using the input {19:2,29:1,39:3} under JDK 1.8.0_472 and Fastjson 2.0.60. Trace the compatibility parsing result and add a regression check; done means the input is parsed completely so its numeric keys and values can be iterated as shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100