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
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
PlantUML had/has(?) a JSON graph mode too, which works well.
Now, this is light years from PlantUML, but Vega abd Vega-Lite can do just about anything with JSON data. It's the most powerful textual graph description vocabulary I've ever seen, by far, but it's too verbose for my average user.
That's not exactly true. This is hostable, just like PlantUML is, but PlantUML also hosts an instance, linked directly on their sidebar: https://www.plantuml.com/plantuml
I'm never in a position where I can use cloud-hosted stuff, sad to say. So everything is hosted in-house. Between that, ITAR, and the general red tape nightmare it's sort of a minor miracle anyone makes anything.
Having said that I really like this new JSONCRACK a lot, now that I've played with it a little.
Looks like a great tool for explaining a JSON object to a less technical audience? I dunno I'm going to give it a shot.
Also, a little meta, but I like that the github page was linked to rather than directly linking to the product's page. It lets me know upfront that this is open source something I'm dealing with. +1 to the submitter
In case you have to do something like this in your code base, d3-hierarchy is gold.
Particularly this digraph() example: https://observablehq.com/@d3/visiting-a-d3-hierarchy.
With a bit of modification away from the GraphViz format, the result fits straight into one of the many graph component visualization libraries like react-flow.
Would be great to get a tool that could diff(erence) two JSON files, with the output being a grid of gray boxes, each gray box represents where a top level element is the same between both, and yellow box represents some sub-level item inside the top level item is not the same between both, blue boxes represent where a new top level element is only present in the left side (added), and red represents only present in the right side (deleted)
You could visually diff a whole lot of reports, pretty much instantly. Our PM had a paid tool that could do this, but wasn't sure what it was.
The JSON spec, of course, has a diff specified, and common json implementation can in fact diff json. You could then put that result back into a graph (since its also just json, in flattened form i believe), and youre done ;)
I did a more rudimentary one that excludes all values with `jq` & `dot`
as my use case was needing to grasp the structure of huge biomedical data dumps.
50 comments
[ 3.2 ms ] story [ 108 ms ] threadSo how is JSON a graph? Or maybe the answer is just, No. Not generally. I'm confused by your question.
No. JSON is not a graph.
Any visualization of a graph from JSON would be a specific encoding of a graph (probably using IDs) which is not generally interpreted as a graph.
{ Left:{}, Right:{} }
Has a tree with 3 nodes
If you don't parse the JSON, you tend to traverse it as a graph
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.
[0] https://www.rfc-editor.org/rfc/rfc6901
https://tree-merge.com/merging-categories-4-independant-diy-...
The conclusion I came to here is that nested/indented lists are actually quite nice to visualise trees. JSON text is already a good visual UI.
Now, this is light years from PlantUML, but Vega abd Vega-Lite can do just about anything with JSON data. It's the most powerful textual graph description vocabulary I've ever seen, by far, but it's too verbose for my average user.
Having said that I really like this new JSONCRACK a lot, now that I've played with it a little.
Not sure how to get rid of the enclosing PlantUML pragmas:
Also, a little meta, but I like that the github page was linked to rather than directly linking to the product's page. It lets me know upfront that this is open source something I'm dealing with. +1 to the submitter
Particularly this digraph() example: https://observablehq.com/@d3/visiting-a-d3-hierarchy. With a bit of modification away from the GraphViz format, the result fits straight into one of the many graph component visualization libraries like react-flow.
You could visually diff a whole lot of reports, pretty much instantly. Our PM had a paid tool that could do this, but wasn't sure what it was.
[0] https://github.com/Wilfred/difftastic [1] https://difftastic.wilfred.me.uk/languages_supported.html
[0] https://github.com/seperman/deepdiff
Once I wrote a simple script to convert json files to `path : value\n` form; that is getting this
."a" : 1 ."b" : {} ."b"."a" : "" ."b"."c" : [] ."b"."c"[0] : true
from the json { "a": 1, "b": { "a": "", "c": [true] } }
It made better diffs but it was also harder to read.
[0] https://marketplace.visualstudio.com/items?itemName=richie5u...
https://github.com/TomConlin/json_to_paths
https://www.json-buddy.com/