Standard way of referencing an object by identity (for, eg, circular references)?

前端 未结 4 1202
暗喜
暗喜 2020-11-29 05:49

Is there a standard way of referencing objects by identity in JSON? For example, so that graphs and other data structures with lots of (possibly circular) references can be

4条回答
  •  [愿得一人]
    2020-11-29 06:26

    Douglas Crockford has a solution that uses JSONPath (an Xpath-like syntax for describing json paths). It seems fairly sane:

    https://github.com/douglascrockford/JSON-js/blob/master/cycle.js

提交回复
热议问题