Get startedGet started for free

Working with Expressions and Dynamic Data

1. Working with Expressions and Dynamic Data

You've been routing data with If and Switch nodes like a pro. But notice something: so far, we've been typing values directly into our nodes. What happens when the data changes every time the workflow runs? We need something dynamic—but what does that actually mean?

2. Static vs. dynamic values

Think of a static value like a date on a sticky note—it stays the same until someone crosses it out. A dynamic value is more like a clock: it updates itself. So far in our workflows, most of what we've typed into Edit Fields nodes has been static. Expressions are how we make those values dynamic.

3. Expressions in n8n

In n8n, expressions live inside double curly brackets. {{ $json.time }} pulls the time field from the current item. If we had hard-coded this field, it wouldn't update with the passage of time, but using an expression keeps the data dynamic and accurate.

4. Expressions in n8n

We can also apply methods inside expressions by chaining them together with dots. Chaining toLowerCase() after json.email converts it to lowercase before passing it along. You don't need to memorize the expression syntax; n8n's drag-and-drop functionality builds the expression for you. But understanding what's under the hood is useful when we need to combine or tweak values. These expressions are evaluated fresh every time the workflow runs, so the output always reflects the latest data.

5. Referencing and inspecting data

The input panel is your best friend here. Open it and we see the JSON output from the previous node. Every field—name, email, category—can be referenced in an expression.

6. Referencing and inspecting data

Inside an Edit Fields node, we switch to expression mode and drag a field from the Input panel straight into the value.

7. Referencing and inspecting data

For nested data—objects inside objects—we expand the structure and reference the path. The key skill isn't memorizing syntax. It's knowing where to look.

8. Example: Expressions in n8n

We have a workflow with a trigger that outputs some user data. Opening the Edit Fields node, we can see the input data on the left. We'll add a new field called full name that combines the two fields using expressions—so instead of typing the values, we're referencing them. We drag the first name field from the Input panel into the center section, which automatically changes the value section into expression mode. We can see the expression that was automatically created: {{ json.name }}. Now instead of a fixed string, this field will always use whatever name came through the trigger. To add the last name, all we need to do is to drag it alongside the first name in the expression box; then insert a space so there's a space between each name. When we execute the step, we can see the new field in the output panel. And if we need to reference nested fields, we use the same approach: expand the field in the input panel and drag it in.

9. Let's practice!

Time to start referencing data in your own workflows—no more hard-coding!

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.