Expression Variables¶
All variables available in expressions.
Current Item Variables¶
$json¶
The current item's JSON data:
// Item: { "name": "John", "age": 30 }
{{ $json.name }} // "John"
{{ $json.age }} // 30
{{ $json }} // { "name": "John", "age": 30 }
$item¶
Current item index (0-based):
$binary¶
Binary data attached to the item:
{{ $binary.data.fileName }} // "document.pdf"
{{ $binary.data.mimeType }} // "application/pdf"
{{ $binary.data.fileSize }} // 1024
Input Data Variables¶
$input¶
Access all input data:
{{ $input.all }} // Array of all input items
{{ $input.first }} // First input item
{{ $input.last }} // Last input item
{{ $input.item }} // Current input item
$input.all Example¶
Node Access Variables¶
$node¶
Access output from any node by name:
Examples¶
// Access HTTP Request output
{{ $node["Fetch Users"].json.users }}
// Access Set node output
{{ $node["Format Data"].json.message }}
// Access first item from node
{{ $node["Get Data"].json }}
Multiple Items from Node¶
// Get all items from a node
{{ $node["Fetch Data"].all }}
// Get specific item
{{ $node["Fetch Data"].item(2).json.field }}
Environment Variables¶
$env¶
Access environment variables:
Usage Example¶
{
"parameters": {
"url": "{{ $env.API_BASE_URL }}/users",
"headers": {
"Authorization": "Bearer {{ $env.API_TOKEN }}"
}
}
}
Date/Time Variables¶
$now¶
Current timestamp (ISO 8601):
$today¶
Current date (YYYY-MM-DD):
Workflow Variables¶
$workflow¶
Workflow metadata:
{{ $workflow.id }} // Workflow ID
{{ $workflow.name }} // Workflow name
{{ $workflow.active }} // Is active
$execution¶
Current execution info:
Parameter Variables¶
$parameter¶
Access node parameters:
Position Variables¶
$position¶
Node position in workflow:
Variable Scope¶
| Variable | Scope | Description |
|---|---|---|
$json |
Per item | Current item data |
$item |
Per item | Item index |
$binary |
Per item | Binary data |
$input |
Per node | All input items |
$node |
Global | Any node's output |
$env |
Global | Environment vars |
$now |
Global | Current time |
$workflow |
Global | Workflow info |
$execution |
Global | Execution info |
Complex Examples¶
Conditional Logic¶
Array Operations¶
String Building¶
Date Formatting¶
Aggregation¶
Best Practices¶
- Use descriptive node names - Makes
$node["Name"]readable - Check for undefined - Use
?.operator - Provide defaults - Use
??or||operators - Keep expressions simple - Complex logic goes in Code nodes
Common Patterns¶
Safe Field Access¶
{{ $json.user?.profile?.email ?? "[email protected]" }}