[BUG]fastjson1默认支持将前后带有下划线的字段名反序列化到没有下划线的字段,fastjson2不支持
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
### 问题描述
*简要描述您碰到的问题。*
String str="{\"_version_\":1821824740974657536}";
QuerySolrArtistInfoVO querySolrArtistInfoVO = JSON.parseObject(str, QuerySolrArtistInfoVO.class);
QuerySolrArtistInfoVO querySolrArtistInfoVO2 = com.alibaba.fastjson2.JSON.parseObject(str, QuerySolrArtistInfoVO.class);
querySolrArtistInfoVO.getVersion(); // 1821824740974657536
querySolrArtistInfoVO2.getVersion(); // null
其中 QuerySolrArtistInfoVO
/**
* 数据版本
*/
@Field("version_s")
private String version;
### 环境信息
### 期待的正确结果
fastjson1默认支持将前后带有下划线的字段名反序列化到没有下划线的字段,fastjson2跟1一样的行为
### 相关日志输出
*请复制并粘贴任何相关的日志输出。*
#### 附加信息
*如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。*
Contributor guide
Research direction
Start by running the Java reproduction with the JSON string and QuerySolrArtistInfoVO shown in the issue, comparing fastjson1 and fastjson2 parseObject behavior. Trace fastjson2's field-name matching during deserialization and add coverage for the surrounding-underscore case; done when the fastjson2 result returns the expected version value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100