Tips > Data, APIs & Webhooks

Use Edit Fields in "Map Each" Mode for Simple Renames

The Edit Fields (Set) node in **Map Each Item** mode is purpose-built for renaming and restructuring fields.

For simple field renames in n8n, use the Edit Fields (Set) node in Map Each Item mode instead of a Code node. You map each output field to an expression that reads the source field, and enable Include Only Set Fields to drop everything else. It stays visually readable, avoids the Code node sandbox, and performs well at high item counts.

When should you use Edit Fields instead of a Code node?

The Edit Fields (Set) node in Map Each Item mode is purpose-built for renaming and restructuring fields. Reserve Code nodes for logic that genuinely requires JavaScript -- loops with conditionals, external library calls, or algorithmic transforms. Using Edit Fields keeps your workflow visually readable and avoids introducing code maintenance overhead for trivial operations.

Real-world example: An incoming webhook delivers contact data with inconsistent field names from a legacy CRM. You need to normalize them before inserting into a database.

How do you rename fields in Map Each Item mode?

Given incoming data per item:

// Incoming data per item:
{
  "FIRST_NAME": "Jane",
  "LAST_NAME": "Doe",
  "EMAIL_ADDR": "jane@example.com",
  "PH_NUMBER": "+1-555-0199"
}

Configure the Edit Fields node in Map Each Item mode with these assignments:

Output Field Expression
firstName {{ $json.FIRST_NAME }}
lastName {{ $json.LAST_NAME }}
email {{ $json.EMAIL_ADDR }}
phone {{ $json.PH_NUMBER }}

Enable "Include Only Set Fields" so extraneous fields from the source are dropped.

// Output per item:
{
  "firstName": "Jane",
  "lastName": "Doe",
  "email": "jane@example.com",
  "phone": "+1-555-0199"
}

This approach is faster to build, easier to audit, and performs well even at high item counts because it avoids spinning up the Code node sandbox.

Related: Flatten Deeply Nested API Responses · Use the HTTP Request Node as a Universal Connector

Showcase builds

19 complete workflows from my own projects, each with its n8n workflow JSON to import. Showcase entries link the file at the end of the article.

See the showcase builds

Keep reading

190 entries grouped by topic, from first workflow to queue mode. Free, no signup.

Browse the encyclopedia

Need it built?

I design, build and run n8n systems for clients. Every engagement starts with a $1,500 diagnostic audit, credited toward the build.

Book an introductory call