For developers · ks-open-format 1
Krazy Stitcher Open Pattern Format
The published layout of Krazy Stitcher pattern files, so other programs, scripts and your own records can read and write them. Version: ks-open-format 1.
A Krazy Stitcher pattern is one JSON object. The grid is a list of bead colors written as #rrggbb, row by row. A separate color map says which bead each color is. Every other field is optional. The same layout is used in .ks files, inside .ksp packages, in your pattern folder, and by File › Export › Export Open Format (.json) in Pro and Studio, which writes it indented so it is easy to read.
Every edition (Essentials, Pro and Studio) opens these files with Import Pattern, whatever the extension (.ks or .json).
JSON Schema for ks-open-format 1 (JSON Schema 2020-12). This page and the schema describe what Krazy Stitcher actually reads and writes; where they and the app disagree, the app is right and this page is out of date.
Start here
A small example
A 3 by 2 loom pattern: a red and a black bead on the top row, then a red bead, an empty space and a black bead.
{
"ksFormat": 1,
"name": "Tiny sample",
"type": "loom",
"width": 3,
"height": 2,
"grid": ["#AE050C", "#111111", null,
"#AE050C", null, "#111111"],
"colorMap": {
"#AE050C": { "id": "DB0723", "name": "Opaque Red" },
"#111111": { "id": "DB0010", "name": "Black" }
},
"notes": "Start at the top left."
}
The colors and codes are Miyuki Delica DB0723 and DB0010 as Krazy Stitcher lists them. Krazy Stitcher writes more fields than this (for example id, created, modified, shape and fringe); a reader may ignore any field it does not need.
Must be present
Required fields
| Field | Type | Rules |
|---|---|---|
width | whole number | Beads across, 1 to 2,000. |
height | whole number | Rows, 1 to 2,000. width × height is at most 4,000,000. |
grid | list | Exactly width × height entries, row by row from the top left: the bead in row r, column c (both counted from 0) is at position r × width + c. Each entry is a color written exactly as #rrggbb (six hex digits, upper or lower case, kept as written) or null for no bead. |
A file without these, or with a grid of the wrong length, is not opened.
May be left out
Optional fields
All of these may be left out. “Edition” says which editions have a tool for the field; every edition keeps every field when it opens and saves a pattern.
| Field | Type and rules | Edition |
|---|---|---|
ksFormat | Whole number, 1 to 1,000: the version of this layout. Written first, as 1, by every Krazy Stitcher that has this page (release F, October 2026). Missing = 1. See Versions. | All |
name | Text, up to 200 characters. Missing or empty: “Imported Pattern”. | All |
type | Stitch type id; see Stitch types. Missing, null or "" = loom. | All |
colorMap | Object: grid color (the same #rrggbb spelling as in grid) → bead. See Beads and brands. Up to 20,000 colors. | All |
id | Text of letters, digits, _ and -, up to 80. Opening a file always gives the pattern a new id. | All |
created, modified | Milliseconds since 1 January 1970 (UTC). | All |
notes | Text, up to 200,000 characters. | All |
shape | rect, triangle, diamond or hexagon: the outline the pattern was started from. | All |
shapeMask | width × height true/false values in grid order; false = no bead may go there. | All |
fringe | One entry per column: null, or a list of up to 500 beads (#rrggbb or null) hanging from that column, top first. | All |
workRow, completedRows | Work Tracker: the current row, and the rows marked done (rows counted from 0 at the top). | All |
originRow, originCol | Whole numbers 0 to 8,000: where row and column numbering starts on printed charts. | All |
symbolOverrides | Object: grid color → one chart symbol from the app’s symbol list. Two colors may not share a symbol. | All |
symbolSet | "easy" for Easy to read symbols (numbers and letters first); missing = Classic shapes. | All |
beadShape | {"mode": "bead", "bead": "11delica", "holes": "auto"} (beads: 11delica, 11round, 11rocaille, 11matsuno, 11millhill, 11aiko, 11treasure, 8round, 15round, 10delica; holes: auto, across, updown) or {"mode": "custom", "ratio": 1.25} (cell height ÷ width, 0.5 to 2). Missing = square cells. | All |
stitchLog | Stitching Timer: list of {"s": start, "ms": length} in milliseconds; the last 1,000 are kept, each at most 24 hours. | All |
splitId, splitOf, splitParentName, splitGrid | Split Pattern: which split a tile belongs to, and where it sits ({"rows", "cols", "r", "c"}). | All |
swap | Brand Swap: the record of the swap that made this pattern (brands, the conversion data set and date, and one row per color). Made by Pro and Studio. | Pro, Studio (all keep it) |
colorways | Up to 3 of {"id", "name", "brand", "map"}: map sends a grid color to {"id": bead code} of that brand. | Pro, Studio |
layers, activeLayerId, activeLayer | Up to 64 layers, each {"id", "name", "grid", "visible", "opacity", "locked"}, bottom layer first; see Editions. | Studio, Essentials (Pro keeps them) |
callouts | Up to 200 of {"id", "kind", "r", "c", ...}: kind is note (with text, up to 80 characters), start, step (with n, 1 to 999) or arrow (with the end at r2, c2, and optional text). Rows and columns count from 0. | Studio |
Studio’s Pattern Package cover design and its “Buy” links are not part of the pattern: they are remembered in the browser, so they are not in the file.
The type field
Stitch types
Stitch types are written as these ids, never as translated names: loom, peyote, peyote2, peyote3, peyote4, peyote5, peyote6, peyote7, peyote8, peyote9 (2- to 9-drop peyote), brick, brick2, brick3, gourd, herringbone, raw (right-angle weave), square, spiral, dutch_spiral, netting, shaped_peyote, ndebele, ladder, albion, crochet-rope.
ladder and albion are Pro and Studio stitches. craw, chenille, triangle and stpetersburg are reserved: they are accepted, but no edition can draw them yet. Any other value is refused.
The colorMap field
Beads and brands
Each colorMap entry may have id (the bead code, for example DB0010 for Miyuki Delica Black), name, finish (the finish chosen while drawing, for example matte; missing = standard) and brand. Other text, number and true/false fields are kept. The pattern does not store a palette: the bead code and name say which bead it is.
brand is written by Brand Swap and is one of delica, toho, preciosa, rocailles, matsuno, millhill. Colorways use their own brand ids: miyuki, toho, preciosa, miyukiRocailles, matsuno, millHill. The two lists are spelled differently; this page records them as the app writes them.
Same file, three editions
Essentials, Pro and Studio files
All three editions write the same layout and open each other’s files. A field an edition has no tool for is kept in the pattern and written back when you save, and the message after opening says so (for example, callouts opened in Essentials or Pro).
- Layers in Studio:
gridis all visible layers combined, bottom (first) to top.activeLayerIdnames the layer being edited. Layeropacityis 0 to 1. - Layers in Essentials:
gridholds the layer named byactiveLayerwhile it is being edited. Layeropacityis a whole percent, 0 to 100. Readers tell the two apart: a value above 1 is a percent, a fraction between 0 and 1 is 0 to 1, and when all values are 0 or 1, a list in which every layer has a true/falselockedis Studio’s 0 to 1. - Layers in Pro: Pro keeps the layers and shows and edits
grid, the layers combined.
Opening untrusted files
What is checked when a file is opened
Pattern files are treated as untrusted. A file is not opened when it is not a JSON object, has no valid width, height or grid, is larger than the limits above, has a grid of the wrong length, uses an unknown stitch type, nests more than 64 levels deep, or has a ksFormat that is not a whole number from 1 to 1,000. A pattern that is already yours (kept in the browser, in a backup, in the pattern folder or in version history) is never dropped for a bad ksFormat: the bad value is removed and the pattern stays.
Anything else that is wrong is cleaned and the file opens: a cell that is not #rrggbb becomes empty, a color entry with a bad key is removed, a layer with a grid of the wrong length is removed, long names and notes are shortened, control characters are removed from text, and numbers are kept within their range. The message after opening says how many cells, colors, layers, names and notes were changed. The keys __proto__, constructor and prototype are removed everywhere.
Fields this version does not know are kept when the name is at most 60 characters and does not start with _. Their values are kept as plain JSON: text up to 2,000 characters, lists up to 1,000 items, objects up to 200 keys, three levels deep. Names that start with _ are the app’s own temporary data; they are never written and are dropped when read.
ksFormat
Versions
This page describes ks-open-format 1. Files written before ksFormat existed have no such field and are version 1. A version adds fields; it does not change what an existing field means. If a later version needs to change the meaning of a field, it will get a new ksFormat number and a new page and schema.
A file with a higher ksFormat than the app knows (made by a newer Krazy Stitcher) still opens: the fields described here are checked as usual, the new fields are kept, and the app says the file is from a newer version. When that pattern is saved again, the file keeps the higher ksFormat number, because it still holds fields this version does not know.
.ks, .json, .ksp
Files that use this layout
.ks: one pattern, compact JSON (Export Pattern / Save File, and the pattern folder)..json: one pattern, indented JSON (Export Open Format, Pro and Studio)..ksp: a zip package with the.ksfile plus a PNG, a PDF chart, a word chart, a bead count CSV andmetadata.json. With a password, the pattern is in.ks.encinstead and is encrypted..ksbackup(Backup All) is a different file: it holds many patterns plus palettes and inventory. Each pattern inside follows this layout, withoutksFormat.
Files are UTF-8 text. The pattern folder does not open files over 50 MB.