Tips > Data, APIs & Webhooks

Chain Multiple Edit Fields Nodes Instead of One Complex Code Node

When a transformation involves several distinct steps -- renaming, filtering, computing derived fields -- resist the urge to pack it all into one Code node.

When a transformation has several distinct steps, chain multiple Edit Fields nodes instead of packing everything into one Code node. Each node handles one logical step -- renaming, currency conversion, status mapping, output trimming -- so the pipeline is self-documenting, easy to debug stage by stage, and maintainable by team members who do not write JavaScript.

Why chain Edit Fields nodes instead of one Code node?

When a transformation involves several distinct steps -- renaming, filtering, computing derived fields -- resist the urge to pack it all into one Code node. Instead, chain multiple Edit Fields nodes, each handling one logical step. This produces a visual pipeline that is self-documenting, easier to debug (you can inspect output at each stage), and maintainable by team members who do not write JavaScript.

How do you build the Edit Fields chain?

Real-world example: An e-commerce webhook delivers raw order data that needs: (1) field renaming, (2) currency conversion, (3) status mapping, and (4) output trimming.

Workflow structure:

[Webhook] → [Rename Fields] → [Convert Currency] → [Map Status] → [Trim Output]

Node 1 -- Rename Fields (Edit Fields):

Output FieldExpression
orderId{{ $json.order_ref }}
customerEmail{{ $json.cust_email }}
rawAmount{{ $json.total_cents }}
rawStatus{{ $json.order_status_code }}

Node 2 -- Convert Currency (Edit Fields):

Output FieldExpression
amountUSD{{ ($json.rawAmount / 100).toFixed(2) }}
(keep others)(Include All Other Fields enabled)

Node 3 -- Map Status (Edit Fields):

Output FieldExpression
status{{ {"1":"pending","2":"processing","3":"shipped","4":"delivered"}[$json.rawStatus] || "unknown" }}

Node 4 -- Trim Output (Edit Fields, Include Only Set Fields):

Output FieldExpression
orderId{{ $json.orderId }}
customerEmail{{ $json.customerEmail }}
amountUSD{{ $json.amountUSD }}
status{{ $json.status }}

How does chaining make debugging easier?

Each node has a clear purpose visible from its name. When something breaks, you click the failing node and immediately see its input and output -- no reading through 40 lines of JavaScript.

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