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.

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.

// Incoming data per item:
{
  "FIRST_NAME": "Jane",
  "LAST_NAME": "Doe",
  "EMAIL_ADDR": "jane@example.com",
  "PH_NUMBER": "+1-555-0199"
}
```text
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.

```json
// Output per item:
{
  "firstName": "Jane",
  "lastName": "Doe",
  "email": "jane@example.com",
  "phone": "+1-555-0199"
}
```text
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](../code-node-mastery/01-flatten-deeply-nested-api-responses.md) | [Use the HTTP Request Node as a Universal Connector](../integration-patterns/01-use-the-http-request-node-as-a-universal-connector.md)

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

191 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 a 20-minute call