Skip to content

File format

Shin Sterneck edited this page Nov 8, 2026 · 1 revision

Diagrams are saved as .stratagram files: plain JSON, easy to generate from scripts (for example from NetBox data). Save as suggests the .stratagram name.

{
  "format": "stratagram",
  "version": 1,
  "devices": [
    { "id": 1, "name": "fw-01", "kind": "firewall", "x": 300, "y": 90, "w": 120, "h": 60,
      "color": "#fecaca", "layer": 20, "z": 1,
      "ports": [ { "id": 6, "name": "port3", "side": "bottom", "t": 0.5 } ] }
  ],
  "links": [
    { "id": 8, "from": { "device": 1, "port": 6 }, "to": { "device": 2, "port": 7 },
      "color": "#334155", "width": 2.0, "style": "solid",
      "head_start": "none", "head_end": "arrow", "routing": "straight", "kind": "trunk", "label": "10G", "label_margin": 32,
      "layer": 20, "z": 0 },
    { "id": 10, "from": { "device": 1, "port": 6 }, "to": { "point": 11 }, "head_end": "arrow" }
  ],
  "points": [ { "id": 11, "x": 360, "y": 300 } ],
  "notes": [
    { "id": 9, "text": "DMZ\nVLAN 20", "x": 280, "y": 20, "size": 14, "color": "#334155", "bold": false,
      "layer": 21, "z": 2 }
  ],
  "layers": [
    { "id": 20, "name": "Physical", "visible": true },
    { "id": 21, "name": "Annotations", "visible": false, "locked": true, "show_name": true }
  ],
  "active_layer": 20
}

See examples/demo.stratagram in the repository and its exports examples/demo.svg and examples/demo.drawio. Generated files may leave out positions and sizes; see Command line.

Fields

Devices and ports

  • t is the position along the side (0 = left/top, 1 = right/bottom).
  • A port's layer puts it on a layer of its own (left out for its device's).

Links

  • A link end is either a port (device + port) or a free connection point (point, with an optional label); points may be left out.
  • kind (plain, trunk, ipsec, vxlan, capwap, sdwan, mpls, l2, l3, l3sub), with an optional over (the kinds carrying it, innermost first, e.g. ["ipsec"]), may be left out for a plain line.
  • label_at (0 to 1 along the line) holds a label placed by hand, and "label_hidden": true hides the label.

Notes

  • A note's x/y is the top left corner of its text; optional w and h give it a fixed box (at its own scale). notes may be left out.

Layers

  • A layer may carry a background: margin, fill, opacity in percent, border (none, solid, dashed or dotted), border_color, border_width, rounded, radius.
  • A layer may carry a frame:
    • template: lines, titleblock, banner, minimal, corporate, report, card, iso, revision, blueprint, change, classification, site, controlled, signoff, solution, proposal, presentation, executive, asbuilt, incident, location or noc;
    • title, subtitle, author, note, show_date, margin, color;
    • as needed company, doc_id, revision, approver, status, level, address, page, show_file, version, owner, review_date, reviewer, customer, summary, installer, commissioned, severity, start, end, services, location, watermark, revisions (rev, date, change, author);
    • logo and logo2 as data URIs of a PNG or JPEG, with logo_w/logo_h and logo2_w/logo2_h. Logos that are not embedded this way (a web address, say) are dropped when the file is opened.
  • changed holds the local date and time of the last change.

Stacking and ids

  • z is the global stacking order (higher is in front, across all layers).
  • layers, layer and z are optional: without them everything goes into one layer, with links under devices and notes on top.
  • Ids only need to be unique within the file; links pointing at missing ports are dropped on load.

Several sheets

A document with several sheets keeps its first sheet at the top level and the others in sheets, a list of the same fields (devices, links, notes, points, layers, active_layer, changed) without format and version. Each sheet's name is optional ("name": "Core"). A one-sheet file has neither, so older versions open the first sheet of any file.

Older files

Files from before the rename (.netdiag, format "netdiag") and older .json files still open, and keep their name when saved with Ctrl+S. On first start, the settings of netdiag (netdiag.conf and its saved logos) move over to stratagram.conf.

Clone this wiki locally