Hacker News new | past | comments | ask | show | jobs | submit login

Of course the display representation on the tool is indeed a graph, but some people might wonder how one can represent a multi-parent node in a JSON tree or have some cyclic structure, which of course is not possible and cause confusion



With JSON pointers [0] this is possible. For example OpenAPI allows them. Can be a pretty useful extension.

[0] https://www.rfc-editor.org/rfc/rfc6901


All JSON would be an acyclic graph, as JSON does not support cyclically linked elements (that I'm aware of). You'd represent encapsulated JSON objects with a structure like a 'polyforest tree'.

If cyclicallity is needed specifically, cyclic graphs do exist, but it was my impression that JSON doesn't have these, or I'm unable to imagine how that would work. While two fields may have the same 'value' in a JSON object, I don't know how I could express cyclicallity using normal JSON syntax to say that two identical values would be linked cyclically.


you are correct, you can't have cycles in json. you can invent conventions for representing cycles, but can't express them natively. i did write a toJS stringifier that handles cycles, but it outputs JS not JSON




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: