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 thenodes 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 theconnections 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 atschema/workflow.schema.json in the repository.
Using the Schema
Version Control
Store workflows in Git:Best Practices
Use Semantic Versioning
Use Semantic Versioning
Follow semantic versioning for workflow changes: major.minor.patch
Add Descriptions
Add Descriptions
Include workflow and node descriptions for documentation
Validate Before Saving
Validate Before Saving
Always validate JSON before committing to version control
Use Variables for Secrets
Use Variables for Secrets
Never hardcode sensitive data - use variables and inject at runtime
Organize by Category
Organize by Category
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: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