alibaba / alibaba/fastjson2

[QUESTION]循环引用时如何正常输出内容而非“$ref”

Open
#3,171 0 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

我的map中有两个同级字段A,B,我使用 map.put(B,A),然后“JSONObject.toJSONString(map)”,如何让其不打印"$ref"而是在B中正常打印A的值呢?

Contributor guide

Open the contributing guide

Research direction

Reproduce the case where a map has sibling fields A and B, B references A via map.put(B, A), and JSONObject.toJSONString(map) emits "$ref". Start by reading the serialization behavior for circular references; done means the B output contains A's value instead of "$ref".

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.