JSON Canvas Specification

repository·main·Indexed 25 days ago

https://github.com/obsidianmd/jsoncanvas

An open file format for infinite canvas data using the .canvas extension. It provides a standardized way for digital whiteboard applications to store, import, and export spatial information via a JSON structure consisting of nodes (text, file, link, group) and edges.

Tokens
1.4K
Snippets
1
Records
8
Agent score
87%

What's inside JSON Canvas

  1. Overview of the JSON Canvas format

    main
    JSON Canvas is an open file format designed for infinite canvas tools (digital whiteboards) to provide longevity, readability, interoperability, and extensibility. It allows users to organize information spatially. Files using this format use the .canvas extension and are designed to be easily parsed by any application.
  2. Define JSON Canvas nodes

    main

    Nodes are objects placed in the nodes array. All nodes must include these generic attributes:

    • id (required, string): A unique identifier.
    • type (required, string): One of text, file, link, or group.
    • x (required, integer): X position in pixels.
    • y (required, integer): Y position in pixels.
    • width (required, integer): Width in pixels.
    • height (required, integer): Height in pixels.
    • color (optional, canvasColor): Color identifier.

    Node Types

    Text Nodes

    • text (required, string): Plain text with Markdown syntax.

    File Nodes

    • file (required, string): Path to the file/attachment.
    • subpath (optional, string): A subpath starting with # (e.g., #heading-name).
    • url (required, string): The target URL.

    Group Nodes

    • label (optional, string): Text label for the group.
    • background (optional, string): Path to a background image.
    • backgroundStyle (optional, string): Rendering style. Valid values: cover, ratio, or repeat.
  3. Structure a JSON Canvas file

    main

    A JSON Canvas file is a JSON object containing two optional top-level arrays:

    • nodes: An array of objects representing elements on the canvas.
    • edges: An array of objects representing connections between nodes.

    Nodes are ordered by z-index: the first node in the array is at the bottom, and the last node is on top.

  4. Define JSON Canvas edges

    main

    Edges are objects in the edges array that connect nodes. Required attributes:

    • id (required, string): A unique identifier.
    • fromNode (required, string): The id of the starting node.
    • toNode (required, string): The id of the ending node.

    Optional attributes:

    • fromSide / toSide: The side where the edge connects. Valid values: top, right, bottom, left.
    • fromEnd: Shape of the start endpoint. Valid values: none, arrow (defaults to none).
    • toEnd: Shape of the end endpoint. Valid values: none, arrow (defaults to arrow).
    • color (optional, canvasColor): Color identifier.
    • label (optional, string): A text label for the edge.
  5. Check JSON Canvas compatibility for Apps

    main

    The following applications support JSON Canvas. Use this list to determine if an app can natively store, import, or export JSON Canvas files.

    NameStorageImportExport
    Obsidian
    Kinopio
    Flowchart Fun
    hi-canvas
    OrgPad
    Charkoal
    Ideaflip
    | Name                                            | Storage | Import | Export |
    | ----------------------------------------------- | :-----: | :----: | :----: |
    | [Obsidian](https://obsidian.md/)                |    ✓    |   ✓    |   ✓    |
    | [Kinopio](https://kinopio.club/)                |         |   ✓    |   ✓    |
    | [Flowchart Fun](https://flowchart.fun/)         |         |   ✓    |   ✓    |
    | [hi-canvas](https://hi-canvas.marknoteapp.com/) |         |   ✓    |   ✓    |
    | [OrgPad](https://orgpad.info/)                 |         |   ✓    |   ✓    |
    | [Charkoal](https://charkoal.dev/)               |    ✓    |   ✓    |   ✓    |
    | [Ideaflip](https://ideaflip.com/)               |         |   ✓    |   ✓    |
  6. Use canvasColor for nodes and edges

    main

    The canvasColor type is a string used to specify colors for nodes and edges. You can use hex codes or one of six preset numeric strings:

    • Hex format: e.g., "#FF0000"
    • Presets:
      • "1": red
      • "2": orange
      • "3": yellow
      • "4": green
      • "5": cyan
      • "6": purple