Whoa! Didn't expect this to bubble up to the top of HN. Some context about why we created JSON Canvas: https://obsidian.md/blog/json-canvas/ We just released it today, so this is still a very nascent project. A little over a year ago we released Obsidian Canvas. The .canvas file format has felt stable enough to give it a name and resources that other apps can freely use. See the original Show HN: https://news.ycombin…
For those having difficulty viewing the spec at the linked jsoncanvas.org site, the spec/1.0 pane on the right has the scrollbar hidden; there's more content if you scroll that pane down.
JSON Canvas – An open file format for infinite canvas data
161–168 of 168 posts
Re: JSON Canvas – An open file format for infinite canvas data
#162I've worked a few jobs now where application data was stored in text files of various kinds (homegrown as well as well-defined formats, JSON included) and it pretty quickly becomes a mess when you start talking about modifying it over time, evolving its schema, validating it in the face of end-user edits, ensuring threads don't write to it concurrently, etc. This strikes me as exactly the type of application data tha…
Re: JSON Canvas – An open file format for infinite canvas data
#163Earlier quoted context omitted.
The author of SQLite is quite open about it. The lack of typing has been part of the design from the beginning. Sqlite has hardly any types: INT INTEGER REAL TEXT BLOB ANY Of course one can program all kind of check constraints, like one can program all kinds of value validations in javascript. Unfortunately, that is not the same as typing. Sqlite lacks typing because, as the sqlite author explains in the docs, flexi…
Aren't these the types? NULL INT(EGER) REAL TEXT BLOB (INTEGER PRIMARY KEY)
Re: JSON Canvas – An open file format for infinite canvas data
#164It would be neat if the README or spec included links to some real-world examples of files - would be easier to start playing with building simple tools on top of this if there was already an example file to start experimenting with, without me having to learn Obsidian first. UPDATE: Figured out how to create one: 1. Install and then open Obsidian 2. Click the "Create new canvas" icon - third down of the icons on the…
https://github.com/obsidianmd/jsoncanvas/blob/main/sample.ca...
Re: JSON Canvas – An open file format for infinite canvas data
#165This is a great idea. For now though, the spec is under-specified and ambiguously terse. A few points that could be clarified: - How do coordinates work? Does +Y point up (OpenGL) or down (web)? Is the origin meaningful? What are the units - how does this interact with font sizes? High-DPI displays? - What’s the difference between a file node and a URL node linking to file://./? Are files supposed to be transcluded?…
This is a data format. This is an abstract data model.
So the spec doesn't specify rendering.
Rendering could however be specified separately (and its reference implementation is Obsidian).
Re: JSON Canvas – An open file format for infinite canvas data
#166I really like the idea of a format for interchange between infinite canvas apps, but the preset colors and list of node types makes this spec feel strangely opinionated. You could build something like Kinopio [1] but not much beyond that. It looks really promising though! I'm definitely interested in seeing this grow. [1] https://kinopio.club
[1] https://twitter.com/KinopioClub/status/1768037179400331692?t...
Re: JSON Canvas – An open file format for infinite canvas data
#167Suggestion: add some metadata at the top level, including a bounding box that includes all nodes so that you can encapsulate a canvas and include it within another context before having created all the elements within it. It's redundant information and it needs to be kept in sync with the nodes and edges, but it's very useful for applications working with your data. Also, this is not very json-ish, but optimizing you…
+1 for bounding box. It would save a lot of computation when trying to determine the initial scale for the canvas, especially if text is involved. It would also make the format useful for fixed-size canvases, not only infinite ones.
I don't think this really has much to do with the "infinite" nature of the canvas. Individual instances of infinite canvases have a finite size. :)
Re: JSON Canvas – An open file format for infinite canvas data
#168Earlier quoted context omitted.
An object in JSON is meant to be unordered [1], so arrays are better if you want order to be preserved. [1] https://www.json.org/json-en.html
Sure, but why do you want order to be preserved? The spec never says the order of nodes is pertinent. Is there undocumented z-index behavior?
> Nodes are placed in the array in ascending order by z-index. The first node in the array should be displayed below all other nodes, and the last node in the array should be displayed on top of all other nodes.