Skip to content
Developer & DevOps

Set vs Code Payload Equivalence Verifier ($& Bug Probe)

10 nodes 29 1 Manual trigger
Download

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. 1.Manual Trigger runs a Code node emitting one fictional item with $&, $&$&, quotes, a number, a nested object and an array
  2. 2.A Set node with official assignments builds five payload fields via reference expressions, retaining source fields via includeOtherFields
  3. 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. 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. 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

  1. Import the JSON into n8n and open the workflow
  2. Run Manual Trigger and verify the final node emits one item with allMatched and totalKeys=9
  3. Normal case: all nine key paths (including payload_quote and nested paths) match with allMatched=true
  4. Mismatch case: change the payload_count Set assignment to a fixed different value, re-run, and see mismatchDetails
  5. Literal $& case: switch Set to JSON mode with $& inside the expression text to test the original issue scenario on your version
  6. 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

Manual Trigger Code Set If No Op Merge

Details

Trigger Manual trigger
Nodes 10
Apps 6
Views 29
Downloads 1

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 (10)

/

Manual Trigger

Manual Trigger

#1

Build Fictional Sample Values

Code

#2

Set: Build Target Payload

Set

#3

Code: Build Reference & Deep Compare

Code

#4

IF: Key Matched?

If

#5

NoOp: Matched Keys

No Op

#6

NoOp: Mismatched Keys

No Op

#7

Merge Report Branches

Merge

#8

Code: Final Equivalence Report

Code

#9

NoOp: Equivalence Report Output

No Op

#10

Stage 1 - Sample Data

Sticky Note

#11

Stage 2 - Dual Build

Sticky Note

#12

Stage 3 - Route & Report

Sticky Note

#13
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