So here is a list of all the commonly used expressions in n8n with a short description and when you might wanna use them. BTW if you do NOT know what are expressions, they are small pieces of JavaScript-like code wrapped in {{ ... }} that dynamically reference and transform data in your workflows.
Core Data Access Expressions
Expression
Description
When to Use
{{$json}}
Accesses the JSON data of the current item
When you need to reference the entire data payload of the current workflow item
{{$json.fieldName}}
Accesses a specific field from the current item
To pull a specific value (e.g., {{$json.body.city}} for webhook data)
{{$json['field name']}}
Accesses a field with spaces or special characters
When field names contain spaces, diacritics, or special characters (e.g., {{$json['Gross Price']}})
{{$binary}}
Accesses binary data of the current item
When working with files, images, or other binary attachments
Referencing Other Nodes
Expression
Description
When to Use
{{$("NodeName").first()}}
Gets the first item from a specific node
When you need only the first result from a previous node
{{$("NodeName").last()}}
Gets the last item from a specific node
When you need only the last result from a previous node
{{$("NodeName").all()}}
Gets all items from a specific node
When you need to work with the complete output of a previous node
{{$("NodeName").item}}
Gets the linked item from a specific node
When using item linking to trace back the source of data
{{$node["HTTP Request"].json.data}}
Alternative syntax for referencing other nodes
When you prefer bracket notation or when node names have special characters
Date and Time Expressions
Expression
Description
When to Use
{{$now}}
Current date and time
To timestamp events or calculate time differences
{{$today}}
Today's date (start of day)
For date-only operations (e.g., filtering by today's date)
{{$now.toFormat("yyyy-MM-dd")}}
Formats current date as a string
When you need dates in specific formats (e.g., 2026-08-04 for APIs)
{{$now.plus({days: 7})}}
Adds time to the current date
For deadline calculations or future date generation
{{DateTime.now().toISO()}}
Luxon DateTime to ISO format
For standard API date formats
Conditional Expressions
Expression
Description
When to Use
{{$if(condition, "true", "false")}}
Returns values based on a condition
For simple conditional logic in node parameters
{{condition ? true : false}}
Ternary operator for conditional logic
For inline conditional assignments (more concise than $if)
{{$ifEmpty(value, defaultValue)}}
Returns default if the first parameter is empty
To provide fallback values when data might be missing
String Manipulation
Expression
Description
When to Use
{{text.toUpperCase()}}
Converts text to uppercase
For standardizing text (e.g., email addresses, codes)
{{text.toLowerCase()}}
Converts text to lowercase
For case-insensitive comparisons or standardization
{{text.includes("foo")}}
Checks if text contains a specific term
For conditional logic based on text content
{{text.extractEmail()}}
Extracts email addresses from text
When you need to parse emails from larger text blocks
{{text.trim()}}
Removes whitespace from text
For cleaning input data before processing
{{`Hello ${$json.name}`}}
Template literals for string building
For constructing dynamic messages or URLs
Array Operations
Expression
Description
When to Use
{{array.length}}
Gets the length of an array
For conditional checks (e.g., "if items > 0 then...")
{{array.join(", ")}}
Joins array elements with a separator
To create comma-separated lists from arrays
{{array.filter(x => x <= 20)}}
Filters array elements based on a condition
To extract specific items from a list (e.g., only active users)
{{array.map(x => x.id)}}
Transforms array elements to new values
To extract specific fields (e.g., get all IDs from a user list)
{{array.find(x => x.id === 123)}}
Finds the first matching element
To locate a specific item in a list
{{array.slice(0, 5)}}
Returns a portion of the array
For pagination or limiting results
Math and Number Operations
Expression
Description
When to Use
{{Math.round($json.price * 1.2)}}
Rounds a number to the nearest integer
For currency calculations or rounding totals
{{Math.floor($json.value)}}
Rounds a number down to the nearest integer
For integer-only operations
{{Math.max(...array)}}
Gets the maximum value from an array
To find the highest value in a dataset
{{Math.min(...array)}}
Gets the minimum value from an array
To find the lowest value in a dataset
{{array.reduce((sum, item) => sum + item.amount, 0)}}
Summarizes array values
For aggregations like total sum or average
Workflow and Environment
Expression
Description
When to Use
{{$env.API_KEY}}
Accesses environment variables
For using sensitive configuration values (API keys, endpoints)
{{$workflow.id}}
Accesses current workflow ID
For logging or tracking workflow executions
{{$execution.id}}
Accesses current execution ID
For debugging or tracking specific runs
{{$execution.mode}}
Current execution mode (test/production)
For conditional behavior based on how the workflow is run
As you can see they are very much close to what we have in ❤️ JavaScript ;)
Top comments (0)