Data Manipulation Mastery: Comprehensive Set Node Guide - n8n Workflow

Master data transformation in n8n using the powerful Set node. Learn expressions, complex objects, conditional logic, and clean output formatting with this essential n8n workflow.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

n8n developers seeking to master data manipulation.
Automation specialists needing to clean and reshape complex API payloads.
Users looking for comprehensive n8n templates focused on core logic.
Anyone needing to understand expressions and conditional branching within an n8n workflow.

Overview

The Set n8n node is arguably the most fundamental tool for data transformation within any n8n workflow. This comprehensive guide provides an invaluable n8n templates resource designed specifically to teach you its full potential.

Automations frequently receive data that is messy, poorly structured, or needs computation before being used in a downstream system. This n8n workflow addresses this by demonstrating six key functionalities:


  1. Setting basic data types (strings, numbers, booleans).

  2. Utilizing advanced JavaScript expressions and references (e.g., {{ $json.field }}).

  3. Constructing complex, nested objects and arrays.

  4. Implementing the "Keep Only Set" option to clean the data payload for final output.

  5. Applying conditional logic using the If n8n node to dynamically set different values based on input data, ensuring your n8n workflow is adaptable to various scenarios.

How it Works

This n8n workflow is initiated by a manual n8n trigger and proceeds through a series of specialized Set n8n nodes:


  1. Start & Basic Values: The manual n8n trigger starts the flow. The first Set n8n node (1. Set Basic Values) establishes initial parameters like username, userage, and isactive.

  2. Expressions: The next Set n8n node (2. Set with Expressions) demonstrates dynamic data creation. It uses expressions to double the score and calculate a timestamp, showing how powerful expressions are within the n8n node environment.

  3. Complex Structures: The third node (3. Set Complex Data) structures the previously simple fields into nested JSON objects (userprofile) and lists (arrays).

  4. Data Cleanup: The fourth node (4. Set Clean Output) activates the "Keep Only Set" option. It selectively pulls necessary information from the complex structure, ensuring only essential, clean data continues in the n8n workflow, dramatically simplifying the payload.

  5. Conditional Branching: The Age Check If n8n node evaluates the initial user_age. The flow splits into two paths: 5a. Set Adult Data (True) and 5b. Set Young Adult Data (False), demonstrating how conditional logic allows different Set n8n nodes to execute.

  6. Merge and Summary: The conditional branches are rejoined using a Merge n8n node, and the final Set n8n node (6. Tutorial Summary) compiles the results, confirming all aspects of the Set node have been covered.

Installation Guide

To use this educational n8n workflow, follow these standard steps:


  1. Copy the JSON: Copy the entire JSON code provided above.

  2. Import into n8n: Navigate to your n8n instance, click 'Workflows', then '+ New', and select 'Import from JSON'. Paste the JSON code.

  3. Execution: Since this n8n workflow uses a Manual Trigger, no external credentials are required.

  4. Run the Tutorial: Click the 'Start (Manual Trigger)' n8n node and press 'Execute Workflow'. Alternatively, disconnect the manual trigger and connect the 'When clicking ‘Execute workflow’ trigger to the '0. Test Data Input' Set n8n node to run the tutorial with pre-configured sample data (like changing the user age to 20 or 30 to test branching).

Node Details

Start (Manual Trigger) / When clicking ‘Execute workflow’: Serves as the initial n8n trigger point to manually start the demonstration. It passes a welcome payload.
0. Test Data Input (Set n8n node): An optional starting point that allows users to easily input sample test data (like changing userage) to test the conditional branches of the n8n workflow.
1. Set Basic Values (Set n8n node):
Function: Establishes initial simple fields (strings, numbers, booleans).
Key Configuration: Sets static values like username (string) and userage (number).
2. Set with Expressions (Set n8n node):
Function: Demonstrates the power of n8n expressions.
Key Configuration: Uses ={{ $json.score 2 }} to perform arithmetic and utilizes $now expressions for date formatting.
3. Set Complex Data (Set n8n node):
Function: Builds nested data structures—defining new object fields (userprofile) and arrays (scorehistory).
4. Set Clean Output (Set n8n node):
Function: Crucial for data cleanup.
Key Configuration: The 'Keep Only Set' option is enabled, ensuring all previous inputs are discarded and only the three newly defined, clean output fields remain in the n8n workflow.
Age Check (If n8n node):
Function: Splits the flow based on a condition ($json.user
age > 25). This shows how to drive conditional actions using the Set n8n node in subsequent steps.
5a/5b. Conditional Set Data (Set n8n node):
Function: Sets unique, conditional values (e.g., offer_type) depending on which branch of the n8n workflow is executed.


  • Merge Branches (Merge n8n node): Combines the conditional paths so the n8n workflow can continue as a single thread.

Related n8n Workflows

Free

Nodes: 6 Nodes
Updated: December 26 2025
View all
Created by
David Olusola
David Olusola

I help ambitious businesses eliminate operational bottlenecks and scale faster with AI automation. My clients typically see 40-60% efficiency gains within 90 days. Currently accepting 3 new projects this quarter - [email protected]

Featured*