The VSON Cookbook

7/24 Page

Getting Started with VSON

All VSON documents are built from a single root Shape. Every VSON document begins with this shape, which sits at the center of your diagram.

This document is the beginning of any VSON drawing. It defines a single shape of default size with default appearance and the label "Hello World" centered on the canvas.

{
  "Version": "1.0",
  "Template": "OrgChart",
  "McpGenerated": true,
  "KeepDocument": true,
  "Shape": {
    "ID": 1,
    "Label": "Hello World"
  }
}
VisualScript hello world shape

Read the VSON Markup Reference to see a complete list of properties you can set on a Shape and the other objects you can add to it.

Clearly most documents don't consist of a single shape. You can make a document with virtually any arrangement of multiple shapes by adding either a ShapeContainer, a ShapeConnector, or a Table to the root shape and then recursively add more shapes to it.

Here's how you'd add a ShapeConnector to the root shape and then add two shapes to the connector:

{
  "Version": "1.0",
  "Template": "OrgChart",
  "McpGenerated": true,
  "KeepDocument": true,
  "Shape": {
    "ID": 1,
    "ShapeConnector": [
      {
        "ShapeConnectorType": "OrgChart",
        "Shapes": [
          { "ID": 2 },
          { "ID": 3 }
        ]
      }
    ]
  }
}
VisualScript simple structure created with a ShapeConnector

Adding a ShapeContainer will produce this visual with the following document:

{
  "Version": "1.0",
  "Template": "Flowchart",
  "McpGenerated": true,
  "KeepDocument": true,
  "Shape": {
    "ID": 1,
    "ShapeContainer": {
      "Arrangement": "Row",
      "Shapes": [
        { "ID": 2 },
        { "ID": 3 }
      ]
    }
  }
}
VisualScript shapes inside a container

Adding a Table to the root shape will give you a nested grid-like arrangement:

{
  "Version": "1.0",
  "Template": "Flowchart",
  "McpGenerated": true,
  "KeepDocument": true,
  "Shape": {
    "ID": 1,
    "FillColor": "#FFFFFF",
    "Table": {
      "Rows": 3,
      "Columns": 3,
      "Cell": [
        { "Row": 1, "Column": 1, "Label": "Cell 1" },
        {
          "Row": 2, "Column": 2,
          "Shape": {
            "ID": 2,
            "FillColor": "#93B0CD",
            "ShapeContainer": {
              "Arrangement": "Row",
              "Shapes": [
                { "ID": 3, "Label": "Choice A", "FillColor": "#FFFFFF" },
                { "ID": 4, "Label": "Choice B", "FillColor": "#FFFFFF" }
              ]
            }
          }
        }
      ]
    }
  }
}
VisualScript shapes inside a table

In the recipes that follow, we will use these building blocks to build lots of different types of diagrams.

7/24 Page