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
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.
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.
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 Field | Expression |
|---|---|
orderId | {{ $json.order_ref }} |
customerEmail | {{ $json.cust_email }} |
rawAmount | {{ $json.total_cents }} |
rawStatus | {{ $json.order_status_code }} |
Node 2 -- Convert Currency (Edit Fields):
| Output Field | Expression |
|---|---|
amountUSD | {{ ($json.rawAmount / 100).toFixed(2) }} |
| (keep others) | (Include All Other Fields enabled) |
Node 3 -- Map Status (Edit Fields):
| Output Field | Expression |
|---|---|
status | {{ {"1":"pending","2":"processing","3":"shipped","4":"delivered"}[$json.rawStatus] || "unknown" }} |
Node 4 -- Trim Output (Edit Fields, Include Only Set Fields):
| Output Field | Expression |
|---|---|
orderId | {{ $json.orderId }} |
customerEmail | {{ $json.customerEmail }} |
amountUSD | {{ $json.amountUSD }} |
status | {{ $json.status }} |
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
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.