Deterministic JSON Canonicalizer for Key-Order-Independent Comparison
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.Manual Trigger starts the run with a single empty item.
- 2.Generate Sample Records emits six fictional {recordId, payload} records.
- 3.Canonicalize And Group validates, recursively sorts keys and outputs canonicalJson, fingerprint and equivalence group id per item.
- 4.Is Canonical routes canonical records to output true and rejected ones to false.
- 5.Two NoOp nodes represent both paths and feed separate Merge inputs.
- 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
- Import the JSON into n8n and click Execute Workflow.
- Confirm R-1001, R-1002 and R-1004 share group G1 and the same canonicalJson.
- Confirm R-1003 forms its own group because array order differs.
- Confirm the last two records are rejected with root_not_object at path $payload.
- Add an Infinity or function value inside payload and verify the rejection reason and path appear.
- 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
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 (8)
Manual Trigger
Manual Trigger
Generate Sample Records
Code
Canonicalize And Group
Code
Is Canonical
If
Canonical Records
No Op
Rejected Records
No Op
Merge Branches
Merge
Build Comparison 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