alibaba / alibaba/fastjson2

[BUG]500KBjson 解析在Android设备上报错

Open
#3,586 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
4.4k
Forks
613
Avg merge
1d 22h
Merged PRs (30d)
6

Description

### 问题描述
500KBjson 解析在Android设备上报错

### 环境信息
*请填写以下信息:*

- OS信息: [荣耀 X60I ]
- JDK信息: [Android 14]
- 版本信息:[Fastjson2 2.0.57]

### 重现步骤
数据文件

```java
public class AdminUnitBean {
public String id = "";
public String title = "";
public boolean disabled = false;
public AdminUnitBean[] children = null;
}

val ret = com.alibaba.fastjson2.JSON.parseArray(string)
```

### 期待的正确结果
可以正常解析

### 相关日志输出

FATAL EXCEPTION: main
Process: com.laizutuan.utstest, PID: 23186
com.alibaba.fastjson2.JSONException: input not end, offset 6, character {, line 2, column 5, fastjson-version 2.0.57
[
{
"title": "北京市",
"id": "110000",
"children": [
{
"title": "北京市",
"id": "1100001",
"children": [
{
"title": "东城区",
"id": "110101",
"children": [],
"disabled": false
},
{
"title": "西城区",
"id": "110102",
"children": [],
"disabled": false
},
{
"title": "朝阳区",
"id": "110105",
"children": [],
"disabled": false
},

#### 附加信息
删除文件内容至362KB 可以正常解析,怀疑与数据文件大小有关。

Contributor guide

Open the contributing guide

Research direction

Start with the JSON.parseArray(string) reproduction on Android 14 using the reported 500KB input, then compare it with the 362KB version that parses successfully. Confirm the failure and identify whether the size-dependent behavior is reproducible; done means the complete sample parses normally on the reported environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.