Skip to content

textmode.export.js / TextmodeExportAPI / toJSON

Method: toJSON() ​

ts
toJSON(options?): TextmodeDocumentJSON;

Produces a v4 document with a nonempty frames array. The full layer stack is included by default. Selected layers retain their visibility, opacity, blending, and transforms.

Parameters ​

ParameterTypeDescription
options?JSONExportOptionsExport options.

Returns ​

TextmodeDocumentJSON

The JSON document representing the selected layer or layer stack.

Examples ​

ts
const layer = t.toJSON({ target: 'selected', layer: t.layers.base, colorMode: 'hex', includeMetadata: true });
const stack = t.toJSON(); // The full layer stack is the default.
console.log(layer.frames[0].layers[0].grid, stack.formatVersion); // 4.0.0