Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

循环引用

温高铁 edited this page Aug 2, 2013 · 6 revisions

fastjson支持循环引用,并且是缺省打开的。

全局配置关闭引用支持

  JSON.DEFAULT_GENERATE_FEATURE |= SerializerFeature.DisableCircularReferenceDetect.getMask();

语法

{"$ref":"$"} 引用根对象
{"$ref":"$"} 引用根对象
{"$ref":"@"} 引用自己
{"$ref":".."} 引用父对象
{"$ref":"../.."} 引用父对象的父对象
{"$ref":"$.members[0].reportTo"} 基于路径的引用
Clone this wiki locally