⚡ n8n Workflow Automation

Set node

n8n Set Node Data Mapping: Fields, Expressions, and JSON
Shape the data before the next node uses it.

Short answer: Use the Set node to add or rename fields, calculate values with expressions, and return a clear JSON shape for the next workflow step.

What does the Set node do?

The Set node changes the item that moves through an n8n workflow. It can add a field, rename a value, remove data, or create a smaller output object.

Use it between nodes when the next step needs a different field name or shape. Keep the change close to the point where it is needed.

How do you add a field?

Add a field and choose its type. Use text for labels, numbers for totals, booleans for flags, and arrays or objects for structured data.

Give the field a name that describes its value. A name such as customer_id is easier to reuse than value1.

How do expressions work in the Set node?

Expressions read data from the current item or from another node. They are useful for combining fields, applying a simple condition, or formatting a value.

Check the preview with a real test item. An expression can be valid while still returning an empty value when the input field is missing.

See the n8n parameters and expressions guide.

Official Set node documentation

When should you rename a field?

Rename a field when two systems use different names for the same value. For example, one API may return userId while the next node expects user_id.

Keep the original when later steps still need it. Remove it only after you confirm that no downstream node reads it.

How do you create a clean JSON object?

Choose only the fields that the next step needs. This keeps the item small and makes errors easier to inspect.

A clean object also protects against accidental data leakage. Do not carry credentials, tokens, or unused personal fields into later nodes.

How should you handle missing values?

Test the input before relying on it. A missing value may produce an empty field, a false condition, or a failed API request.

Use a default only when an empty value has a clear meaning. Do not replace missing data with a guess.

What should you test before connecting the next node?

  1. Run the previous node with a known item.
  2. Check every new field in the output preview.
  3. Test one missing field.
  4. Confirm numbers, text, arrays, and booleans keep their intended types.
  5. Open the next node and confirm it reads the new field names.

For code-based transformations, see JavaScript and Python examples. For a wider node map, see n8n integration nodes.

References


Leave a Reply

Your email address will not be published. Required fields are marked *