alibaba / alibaba/fastjson2

[QUESTION]fastjson序列化生成$ref的引用后,如何在解析的时候将$ref再解析为jsonobject呢

Open
#2,139 1 comment 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

当前使用的版本:fastjson2 2.0.43
![image](https://github.com/alibaba/fastjson2/assets/18159554/c2f6cbb3-f188-4f92-b3b8-565e6ebe4070)

解析代码:
String fileData = loadFile("E:\\demo\\data\\qyqd\\test\\20231228.json");
JSONObject doc = JSON.parseObject(fileData);

实际效果:仍然是$ref, 期望$ref为实际的json对象

Contributor guide

Open the contributing guide

Research direction

Start with the JSON.parseObject call in the issue and reproduce the behavior using the fastjson2 2.0.43 version and the referenced JSON sample. Check how the serialized $ref is represented during parsing; done means the reference is resolved to the expected JSONObject rather than remaining as $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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.