Skip to content
Developer & DevOps

Set JSON-Mode Expression Migrator to Safe Manual Mapping with Field-by-Field Verification

7 nodes 20 0 Manual trigger
Download

Loading workflow…

Workflow Description

A fully local workflow that migrates expressions previously written inside a Set node JSON body into safe manual mappings. A Code node declares seven demo expressions and evaluates them with explicit JavaScript: `$` and `&` are produced via String.fromCharCode and a replacer function, so the literal `$&` is never consumed as a regex token. The Set node then stores results as plain typed assignments (string, number, boolean, object) with no JSON text. An IF node compares each mapped value to its expected value; mismatches are isolated through NoOp into a separate Merge input, and a final Code node emits one migration report with counts, success rate and mismatch details.

How it works

  1. 1.Manual Trigger starts the run with a single empty item
  2. 2.Code node declares the expression catalogue locally and evaluates each entry inside try/catch, producing canonical value, type and expectation
  3. 3.Set node (manual mapping) writes migrationStatus plus string/number/boolean/object values with includeOtherFields:true
  4. 4.IF node compares mappedValueText with expectedComparable using strict string equals
  5. 5.True branch feeds Merge input 1; false branch passes through NoOp into Merge input 2
  6. 6.Final Code node (runOnceForAllItems) returns exactly one migration report object

Use cases

  • Safely migrating Set JSON-mode expressions to manual mapping
  • Proving field-by-field value equivalence after rewriting expressions
  • Testing expressions containing $, & or $& before production rollout
  • Producing a migration quality report during code review

Requirements

  • n8n 2.46.7 or newer
  • No credentials and no network access required
  • Edit the definitions array in the first Code node to insert your real expressions and expected values

Setup and testing in n8n

  1. Import the JSON workflow into n8n
  2. Click Execute Workflow and confirm the first Code node outputs seven items
  3. Open the Set node and verify no JSON mode is used and types are correct
  4. Inspect the report: 7 expressions, 5 matched, 2 mismatched, 1 evaluation error
  5. Invalid cases: discountLabel differs from expectation and brokenRef fails evaluation; both appear in mismatches
  6. Change the expected value of discountLabel to -10%&off and re-run to see 6 matched

Service Value

Ready-made workflow template for automation delivery and service execution.

Apps Used

Manual Trigger Code Set If No Op Merge

Details

Trigger Manual trigger
Nodes 7
Apps 6
Views 20
Downloads 0

How to Use

  1. 1.Click "Download Template"
  2. 2.Open your n8n dashboard
  3. 3.Go to Workflows > Import from File
  4. 4.Select downloaded file and configure credentials

Nodes Used (7)

Manual Trigger

Manual Trigger

#1

Evaluate Expressions Safely

Code

#2

Set Manual Mapping

Set

#3

IF Value Matches Expected

If

#4

Isolate Mismatches

No Op

#5

Merge Verified And Mismatched

Merge

#6

Build Migration Report

Code

#7

Sticky Stage 1

Sticky Note

#8

Sticky Stage 2

Sticky Note

#9

Sticky Stage 3

Sticky Note

#10
Stay in the loop

Fresh workflows, straight to your inbox

Get newly published DROPIDEA workflows, a clear overview of what they do, and a link to explore them.

  • New workflows
  • Clear overviews
  • Setup guides

Be first to discover what is new

Your name, your email, and one confirmation.

Email confirmation · Unsubscribe anytime