alibaba / alibaba/fastjson2

[FEATURE] 支持从子结构体中去除指定变量

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

Description

`@JSONField(exclude = {"field1", "field2"})`

这个功能对于连表查询使用`unwrap = true`时特别有用:
```
public class Course {
// course.id
private Integer id;
// course.student_id
private Integer studentId;
// JOIN student ON course.student_id = student.id
@JSONField(unwrap = true, exclude = {"id"})
private Student student;
}
```

Contributor guide

Open the contributing guide

Research direction

Start at the @JSONField handling for unwrap and exclude, using the Course/Student example in the issue as the behavior to trace. Add a regression test for an unwrapped nested object with exclude = {"id"}; done means the nested id is omitted while other nested fields remain serialized.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.