alibaba / alibaba/fastjson2

[QUESTION] 请问在fastjson2中,有禁止循环引用的功能吗,就是去掉 $ref 的意思

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

Description

fastjson1中,可以通过全局设置
JSON.DEFAULT_GENERATE_FEATURE |= SerializerFeature.DisableCircularReferenceDetect.getMask();
或使用
JSON.toJSONString(obj, SerializerFeature.DisableCircularReferenceDetect);
来禁止循环引用

但在fastjson2中,找不到类似的功能。
在使用fastjson v1兼容版本中,也达不到fastjson1的效果。

谢谢!

Contributor guide

Open the contributing guide

Research direction

The issue references fastjson1's SerializerFeature.DisableCircularReferenceDetect and the fastjson v1 compatibility version, but names no fastjson2 file or test. Start by locating the fastjson2 serialization options and checking how the compatibility API handles circular references. Done means confirming an equivalent supported option or documenting that it is unavailable.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.