KEEP LEARNING
Build the bigger picture.
The Workflow Engineer connects individual n8n concepts to testing, deployment and running a complete workflow.
Tips > Data, APIs & Webhooks
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.
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.
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
KEEP LEARNING
The Workflow Engineer connects individual n8n concepts to testing, deployment and running a complete workflow.
APPLY IT TO YOUR SYSTEM
Bring the process, the tools involved and an example of where the current workflow gets stuck.