Skip to content
Data & Databases

JSON Round-Trip Value Drift Auditor

11 nodes 17 1 Manual trigger
Download

Loading workflow…

Workflow Description

A self-contained workflow measuring how values change after JSON.stringify followed by JSON.parse. A Code node emits four fictional payload specs that encode values which cannot travel as JSON between nodes (NaN, Infinity, -0, cycles) as string sentinels; the audit node rehydrates them into real JavaScript values. It validates structure first, rejecting cycles, BigInt, functions, symbols and undefined with path and reason, then runs the round trip and compares leaves using Object.is, Number.isNaN and Number.isFinite with a cause classification. Two IF nodes route results, Merge joins branches, and a final Code node emits exactly one aggregated report.

How it works

  1. 1.Manual Trigger emits a single empty item
  2. 2.Build Sample Payload Specs creates clean, sentinel-based non-finite/-0, circular and payload-missing records
  3. 3.Audit Round-Trip Drift rehydrates sentinels into real JavaScript values
  4. 4.It validates structure and rejects cycles and unsupported types with path and reason
  5. 5.It serializes, parses and compares every leaf path with Object.is
  6. 6.Round-Trip Completed? splits rejected from completed; Has Drift? routes on driftCount > 0
  7. 7.Set nodes stamp status with includeOtherFields:true keeping ids and drift lists
  8. 8.Merge with three inputs collects branches and Build Drift Report returns one report

Use cases

  • Verify computed JavaScript numbers before persisting them as JSON
  • Detect NaN/Infinity collapsing to null in integration payloads
  • Detect lost negative-zero semantics before comparisons
  • Reject circular or non-serializable structures with the exact path

Requirements

  • n8n 2.48.7 with Manual Trigger, Code, IF, Set and Merge nodes
  • Items shaped { recordId, payloadSpec } using sentinels for special values
  • No credentials and no external calls
  • Output is a value-drift report, not a canonical fingerprint and not RFC 8785 compliant

Setup and testing in n8n

  1. Import the JSON and click Execute Workflow
  2. Open Build Drift Report and confirm totalRecords=4, analyzedRecords=2, rejectedRecords=2, totalDrifts=4
  3. Confirm P-2 lists four drifted paths with their classifications
  4. Confirm P-3 is rejected for circular_reference at $.self and P-4 for missing_payload at $
  5. Change the spec to only finite numbers and strings and verify driftCount=0 with status no_drift

Service Value

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

Apps Used

Manual Trigger Code If Set Merge No Op

Details

Trigger Manual trigger
Nodes 11
Apps 6
Views 17
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 (11)

/

Manual Trigger

Manual Trigger

#1

Build Sample Payload Specs

Code

#2

Audit Round-Trip Drift

Code

#3

Round-Trip Completed?

If

#4

Has Drift?

If

#5

Mark Drift Detected

Set

#6

Mark No Drift

Set

#7

Mark Rejected

Set

#8

Collect Branches

Merge

#9

Build Drift Report

Code

#10

Audit Trail

No Op

#11

Note Input

Sticky Note

#12

Note Audit

Sticky Note

#13

Note Routing

Sticky Note

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