Set JSON-Mode Expression Migrator to Safe Manual Mapping with Field-by-Field Verification
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.Manual Trigger starts the run with a single empty item
- 2.Code node declares the expression catalogue locally and evaluates each entry inside try/catch, producing canonical value, type and expectation
- 3.Set node (manual mapping) writes migrationStatus plus string/number/boolean/object values with includeOtherFields:true
- 4.IF node compares mappedValueText with expectedComparable using strict string equals
- 5.True branch feeds Merge input 1; false branch passes through NoOp into Merge input 2
- 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
- Import the JSON workflow into n8n
- Click Execute Workflow and confirm the first Code node outputs seven items
- Open the Set node and verify no JSON mode is used and types are correct
- Inspect the report: 7 expressions, 5 matched, 2 mismatched, 1 evaluation error
- Invalid cases: discountLabel differs from expectation and brokenRef fails evaluation; both appear in mismatches
- 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
Details
How to Use
- 1.Click "Download Template"
- 2.Open your n8n dashboard
- 3.Go to Workflows > Import from File
- 4.Select downloaded file and configure credentials
Nodes Used (7)
Manual Trigger
Manual Trigger
Evaluate Expressions Safely
Code
Set Manual Mapping
Set
IF Value Matches Expected
If
Isolate Mismatches
No Op
Merge Verified And Mismatched
Merge
Build Migration Report
Code
Sticky Stage 1
Sticky Note
Sticky Stage 2
Sticky Note
Sticky Stage 3
Sticky Note
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