Mastering Data Expressions, Selectors, and JavaScript Utility Functions - n8n Workflow

Learn to master n8n expressions, selectors, and JavaScript utility functions. This comprehensive n8n workflow template teaches essential data linking between every n8n node.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Beginner n8n users who struggle with connecting data between different nodes.
Intermediate n8n users looking to master complex selectors, array manipulation, and JavaScript functions within expressions.
Automation developers seeking robust n8n templates for foundational skill building.
Anyone wanting a deep dive into how the n8n expression engine works.

Overview

The ability to transfer and transform data between steps is the most crucial skill in automation. Without it, your n8n workflow is limited to static actions. This n8n workflow serves as an interactive lesson, transforming theory into practice. It begins with a single source of structured JSON data and guides you through 10 distinct lessons, teaching you how to retrieve simple values, access items in complex arrays and nested objects, inspect data types, and apply powerful JavaScript utility functions. By completing this n8n tutorial, you will gain the foundational knowledge required to build highly dynamic and responsive n8n templates, maximizing the potential of every n8n node you use.

How it Works

This n8n workflow operates linearly, serving as a self-paced tutorial activated by a manual n8n trigger.


  1. Start and Source Data: The workflow begins with the manual n8n trigger and immediately executes the 'Source Data' n8n node, which defines a complex JSON object containing various data types (strings, numbers, arrays, nested objects).

  2. Lesson 1 & 2 (Basics & Selectors): The first two lessons demonstrate simple data retrieval, showing how to access a key (e.g., name) using the basic $json object and more robust n8n selectors like .last() to ensure stable data referencing.

  3. Lesson 3, 4, & 5 (Indexing): These lessons focus on complex data structures, teaching users how to use array indexing ([1]) to access specific items in a list and how to navigate deeply nested JSON objects using sequential dot notation (e.g., contact.email)—a core skill for any n8n workflow.

  4. Lesson 6 (Functions): This n8n node introduces built-in JavaScript functions like .toUpperCase() and Math.round(), demonstrating how to manipulate data directly within the expression block.

  5. Lesson 7 & 8 (Utilities): These advanced steps teach utility functions like Object.keys() for inspecting unknown data structures and JSON.stringify() for formatting complex objects into readable strings, often essential when interacting with third-party APIs or preparing data for an AI n8n node.

  6. Lesson 9 (Multiple Items): A Split Out n8n node prepares the data, and the subsequent Set node demonstrates using .all().map() with arrow functions to iterate over multiple output items and aggregate them into a single string.

  7. Final Exam: The final n8n node consolidates all learned expression techniques by pulling specific data points from eight different upstream nodes, building a complex, dynamic summary string to confirm mastery of the n8n templates concept.

Installation Guide

To utilize this educational n8n workflow, follow these steps:


  1. Import the JSON: Copy the provided n8n workflow JSON data.

  2. Log into your n8n instance and navigate to 'Workflows'.

  3. Click 'New' and select the option to import the workflow from JSON.

  4. Execution: Since this is a tutorial, no credentials are required. Simply click on the 'Start Tutorial' n8n trigger node and click 'Execute Workflow' (or 'Test Workflow' in older versions).

  5. Follow the Lessons: Progress through the steps by executing the workflow and reviewing the configuration and output of each subsequent 'Set' n8n node, reading the corresponding 'Sticky Note' for theoretical context. This approach ensures you master every aspect of the n8n templates provided.

Node Details

This n8n workflow utilizes several key n8n node types to deliver the educational content:

Start Tutorial (Manual Trigger): The initiating n8n trigger for the entire learning sequence. It allows for easy, one-click execution to start the data flow.

Source Data (Set n8n Node): This critical n8n node is the foundation. It creates sample data with complex structures (nested objects, arrays of objects) which all subsequent lessons reference. Key configuration includes defining name, age, skills, projects, and contact fields.

1. The Basics (Set n8n Node): Demonstrates the simplest expression structure: ={{ $('Source Data').item.json.name }}. Teaches basic key retrieval in an n8n node.

2. The n8n Selectors (Set n8n Node): Focuses on best practices by using the safer .last() selector: ={{ $('Source Data').last().json.name }}. This is vital for reliable n8n workflow design.

5. The Combo Move (Set n8n Node): Shows advanced chaining required for complex n8n templates. The expression ={{ $('Source Data').last().json.projects[0].status }} successfully accesses an array element and then pulls a key from the object within that array.

6. A Touch of Magic (Set n8n Node): Highlights the power of embedded JavaScript. Expressions include string manipulation (.toUpperCase()) and mathematical functions (Math.round(...)), showcasing how the n8n expression engine supports complex operations.

Split Out Skills (Split Out n8n Node): A utility n8n node used to split the skills array into individual items. This prepares the data for the advanced aggregation lesson.

9. The "All Items" View (Set n8n Node): Features the most advanced selector syntax using map functions to aggregate data from multiple items: ={{ $('Split Out Skills').all().map(item => item.json.skills).join(', ') }}. This is a powerful technique for summarizing data across the n8n workflow.

Related n8n Workflows

Free

Nodes: 4 Nodes
Updated: December 26 2025
View all
Created by

Innovative builder with a passion for crafting automation solutions that solve real-world challenges. From streamlining workflows to driving efficiency, my work empowers teams and individuals to achieve more with less effort. Experienced in developing scalable tools and strategies that deliver results with n8n, supabase and cline.

Featured*