Novolis Docs
novolis-apps / sketch-studio/sketchjson.md

Sketch JSON (host notes)

dotnetavaloniadesktopnovolis

← Documentation index · Documents

Authoritative contract

Full wire format (versions, fields, examples, legacy v1):

[`novolis-governance/docs/sketchjson.md`](../../../novolis-governance/docs/sketchjson.md)

Implementation: Novolis.Avalonia.Controls.Sketch → SketchJson.Serialize / Deserialize.

This page only covers how Sketch Studio uses the format.

Host responsibilities

ConcernHost behavior
File filter*.sketchjson on Open / Save As
ExtensionAppends .sketchjson if the user omits it
Grid syncCopies SketchControl grid props onto doc.Grid before serialize
Dirty / MRUOutside the file — Documents
PNG / SVGOutside the file — Export

Features that need version 2+

Speech bubble / text / text box / image / rotation / fuse groups require v2 fields (kind, rotationDegrees, groupId, text, fontSize, imagePngBase64).

Layers (version 3)

When extra layers exist (or elements leave the default layer), documents write version: 3 with:

  • layers[] — id, name, optional visible / locked
  • activeLayerId
  • element layerId (omitted when default)

Hidden layers are skipped in the canvas and in PNG/SVG export. Locked layers reject paint-bucket / erase / transform.

Colors

strokeColor / fillColor accept #RRGGBB or #AARRGGBB (alpha). Fully transparent: #00000000.

Round-trip checks

  • Unit: Novolis.Avalonia.Unit / SketchDocumentTests
  • Host: --smoke exercises serialize → deserialize of fused + text + layers + fill — Smoke and release

Not CAD

Do not confuse with `.cadjson` (Novolis CAD Studio). Sketch is freehand / whiteboard; CAD is analytic geometry.