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

前端 未结 4 1203
暗喜
暗喜 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条回答
  •  Happy的楠姐
    2020-11-29 06:21

    There is the "JSON Reference" specification, but it seems it didn't got over the state of an expired Internet draft.

    Still, it seems to be used in JSON Schema and Swagger (now OpenAPI) (for reusing parts of an API description in other places of the same or another API description).

    A reference to an object in the same file looks like this: { "$ref": "#/definitions/Problem" }.

提交回复
热议问题