Skip to main content
CrystalFlow workflows are fully serializable to JSON, enabling version control, sharing, and programmatic manipulation of workflows.

Overview

Every CrystalFlow workflow can be:
  • Serialized to JSON for storage
  • Deserialized from JSON to recreate workflows
  • Validated against a formal JSON Schema
  • Version controlled in Git
  • Shared across teams and applications

Workflow JSON Format

The workflow JSON format follows this structure:

Top-Level Fields

string
required
Schema version (currently "1.0.0")
string
required
Unique identifier for the workflow
string
Human-readable workflow name
string
Optional description of the workflow’s purpose
Node[]
required
Array of node definitions
Connection[]
required
Array of connections between nodes
Record<string, any>
Global variables accessible during execution

Node Format

Each node in the nodes array has this structure:

Node Fields

string
required
Unique identifier for the node within the workflow
string
required
Node type identifier (e.g., "math.add", "http.request")
{x: number, y: number}
required
Visual position on the canvas
Record<string, any>
Input port values (for unconnected inputs)
Record<string, any>
Property values set via @Property decorator
object
Additional metadata (label, category, description)

Connection Format

Each connection in the connections array:

Connection Fields

string
required
Unique identifier for the connection
string
required
ID of the source node
string
required
Name of the output port on the source node
string
required
ID of the target node
string
required
Name of the input port on the target node

Serialization API

To JSON

Convert a workflow to JSON:

From JSON

Load a workflow from JSON:

Validation

Validate workflow JSON against the schema:

Complete Example

Here’s a complete workflow JSON with multiple nodes and connections:
workflow.json

Loading This Workflow

Schema Validation

The formal JSON Schema is available at schema/workflow.schema.json in the repository.

Using the Schema

Version Control

Store workflows in Git:

Best Practices

Follow semantic versioning for workflow changes: major.minor.patch
Include workflow and node descriptions for documentation
Always validate JSON before committing to version control
Never hardcode sensitive data - use variables and inject at runtime
Store related workflows in organized directories

Programmatic Workflow Creation

Create workflows programmatically from JSON:

Migration Between Versions

When the schema version changes, use migration utilities:
Breaking Changes: Schema version 1.0.0 has not been published yet. Until then, breaking changes may occur without migration paths.

Export Formats

Minified JSON

Pretty JSON

Next Steps

Serialization Guide

Learn advanced serialization techniques

Workflow API

Complete Workflow API reference

Creating Workflows

Build custom workflows

Version Control

Best practices for Git