Set vs Code Payload Equivalence Verifier ($& Bug Probe)
Loading workflow…
Workflow Description
A manual-trigger workflow emits fictional data containing $&, $&$&, quotes, a number, nested objects and arrays. A Set node (official assignments mode, including the quote-bearing field) builds the target payload via reference expressions while a Code node rebuilds the identical reference payload in JavaScript, then deep-compares both by flattening them into key paths with type checks. An IF splits matched vs mismatched keys, Merge (append) rejoins both branches, and a final Code node emits one equivalence report. No credentials, no external calls.
How it works
- 1.Manual Trigger runs a Code node emitting one fictional item with $&, $&$&, quotes, a number, a nested object and an array
- 2.A Set node with official assignments builds five payload fields via reference expressions, retaining source fields via includeOtherFields
- 3.A Code node rebuilds the same payload as a reference, deep-flattens both structures into key paths, compares each by value and type, and emits one item per key
- 4.An IF node routes matched and mismatched keys to separate NoOp branches; Merge (append) rejoins them via two distinct input indexes without item loss
- 5.A final Code node aggregates everything into one report counting matches and mismatches with details and the Code-alternative recommendation
Use cases
- Probing your local n8n build before publishing workflows that construct dynamic JSON payloads with Set
- Detecting values like $& that break Set expressions and confirming the stable Code alternative
- Documenting per-key payload differences in a pre-publish review
Requirements
- n8n 2.46.6 with the allowed nodes (manualTrigger, code, set, if, merge, noOp, stickyNote)
- No credentials and no external calls — the workflow is fully self-contained
- To use real input: replace the Build Fictional Sample Values node with your source keeping the same field names; the comparer processes the first item, so add a loop node for multi-item batches
- To probe the exact original issue scenario (JSON mode): switch the Set node to JSON mode with a literal $& inside the expression and re-run
Setup and testing in n8n
- Import the JSON into n8n and open the workflow
- Run Manual Trigger and verify the final node emits one item with allMatched and totalKeys=9
- Normal case: all nine key paths (including payload_quote and nested paths) match with allMatched=true
- Mismatch case: change the payload_count Set assignment to a fixed different value, re-run, and see mismatchDetails
- Literal $& case: switch Set to JSON mode with $& inside the expression text to test the original issue scenario on your version
- Verify missing input is handled via the NO_INPUT message in the compare node
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 (10)
Manual Trigger
Manual Trigger
Build Fictional Sample Values
Code
Set: Build Target Payload
Set
Code: Build Reference & Deep Compare
Code
IF: Key Matched?
If
NoOp: Matched Keys
No Op
NoOp: Mismatched Keys
No Op
Merge Report Branches
Merge
Code: Final Equivalence Report
Code
NoOp: Equivalence Report Output
No Op
Stage 1 - Sample Data
Sticky Note
Stage 2 - Dual Build
Sticky Note
Stage 3 - Route & Report
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