Skip to content
Data & Databases

Deterministic JSON Canonicalizer for Key-Order-Independent Comparison

8 nodes 56 5 Manual trigger
Download

Loading workflow…

Workflow Description

A fully local workflow that turns JSON records into a stable canonical representation. A Code node emits six fictional records, then the canonicalizer validates that each root is a plain object and that every value is inside the declared JSON domain, rejecting undefined, functions, symbols, BigInt, non-finite numbers and circular references with value path and reason. Object keys are sorted recursively at all depths while array element order is preserved, producing canonicalJson plus an FNV-1a fingerprint used only for indexing. Equivalence groups come from full canonical string comparison; IF separates rejects, and one final Code node builds a single report.

How it works

  1. 1.Manual Trigger starts the run with a single empty item.
  2. 2.Generate Sample Records emits six fictional {recordId, payload} records.
  3. 3.Canonicalize And Group validates, recursively sorts keys and outputs canonicalJson, fingerprint and equivalence group id per item.
  4. 4.Is Canonical routes canonical records to output true and rejected ones to false.
  5. 5.Two NoOp nodes represent both paths and feed separate Merge inputs.
  6. 6.Build Comparison Report runs once for all items and returns exactly one report item.

Use cases

  • Detect structurally equivalent records despite different key order
  • Reconcile data before generating diff reports
  • Remove false diffs in regression testing
  • Cluster duplicate copies of nested objects

Requirements

  • n8n 2.48.7
  • Core nodes only: manualTrigger, code, set, if, merge, noOp, stickyNote
  • No credentials or API keys needed
  • Input shaped as {recordId, payload} with payload being an object

Setup and testing in n8n

  1. Import the JSON into n8n and click Execute Workflow.
  2. Confirm R-1001, R-1002 and R-1004 share group G1 and the same canonicalJson.
  3. Confirm R-1003 forms its own group because array order differs.
  4. Confirm the last two records are rejected with root_not_object at path $payload.
  5. Add an Infinity or function value inside payload and verify the rejection reason and path appear.
  6. Run with an empty item list to exercise the empty_input path.

Service Value

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

Apps Used

Manual Trigger Code If No Op Merge

Details

Trigger Manual trigger
Nodes 8
Apps 5
Views 56
Downloads 5

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

/

Manual Trigger

Manual Trigger

#1

Generate Sample Records

Code

#2

Canonicalize And Group

Code

#3

Is Canonical

If

#4

Canonical Records

No Op

#5

Rejected Records

No Op

#6

Merge Branches

Merge

#7

Build Comparison Report

Code

#8

Sticky Stage 1

Sticky Note

#9

Sticky Stage 2

Sticky Note

#10

Sticky Stage 3

Sticky Note

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