alibaba / alibaba/fastjson2

[BUG] parseArray不能忽略空的值,而是抛出异常

Open
#2,977 2 comments 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

com.alibaba.fastjson2.JSONException: offset 28, character ,, line 1, column 28, fastjson-version 2.0.52 [[21976997982896132,1000,0,,,0]]

对这个[[21976997982896132,1000,0,,,0]]进行parseArray的时候,在fastjson1中,是会忽略连续的几个逗号的,但是在fastjson2中,会抛出异常,实际上这几个逗号,可能是代表没有值,有没有办法回到fastjson1中的行为(忽略逗号,只匹配有值的数)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the parseArray failure with [[21976997982896132,1000,0,,,0]] and compare it with fastjson1 behavior. Trace the parseArray entry point and existing parser tests, then verify that consecutive empty values are ignored and populated numeric values still parse correctly.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.