Skip to content
Data & Databases

Recovery vs Corruption Classifier for Double-Serialized Fields and [object Object]

9 nodes 37 3 Manual trigger
Download

Loading workflow…

Workflow Description

A fully local workflow: a Manual Trigger feeds a Code node that emits fictional records containing a once-serialized JSON string, a double-serialized JSON string, a field literally holding [object Object], and an empty string. The classifier Code node scans every string field: the literal marker means unrecoverable corruption; otherwise repeated JSON.parse runs until the value stabilises, recording serialization depth and the parsed value; everything else stays plain text. An IF node splits corrupted from recoverable records, a Merge node appends both routes, and a final Code node returns exactly one sorted report item shown by a NoOp node.

How it works

  1. 1.Manual Trigger sends one empty item to the sample generator.
  2. 2.Load Sample Records emits 4 records: once-serialized, double-serialized, containing [object Object], and an empty string field.
  3. 3.Classify Serialization Depth inspects each string field and labels it corrupted, recovered with depth, or plain text.
  4. 4.IF evaluates has_corrupted: output 0 corrupted, output 1 recovered/clean.
  5. 5.Two Set nodes add a route field with includeOtherFields:true so classification data is preserved.
  6. 6.Merge in append mode joins both routes through separate inputs.
  7. 7.Build Single Report (runOnceForAllItems) returns one report item sorted by record_id, displayed by the NoOp node.

Use cases

  • Audit webhook payloads whose nested objects were implicitly stringified.
  • Decide which fields can be salvaged with JSON.parse and which are permanently lost.
  • Measure double-serialization depth in data arriving from middleware.
  • Produce a data-quality report before database insertion.

Requirements

  • n8n 2.46.4 or newer; no credentials needed since the workflow is self-contained.
  • For real data, replace Load Sample Records with a Webhook or HTTP Request node returning flat objects with string fields.
  • Keep both Code nodes in runOnceForAllItems mode.

Setup and testing in n8n

  1. Import the JSON into n8n and click Execute Workflow.
  2. Check REC-001 has depth 1 and REC-002 depth 2 with the correct parsed object.
  3. Check REC-003 status is corrupted and body appears in corrupted_fields.
  4. Check REC-004 status is clean and the empty string field is in plain_text_fields.
  5. Edge case: make the sample node return an empty array and confirm the report yields total_records = 0 without errors.

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 9
Apps 6
Views 37
Downloads 3

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

/

Manual Trigger

Manual Trigger

#1

Load Sample Records

Code

#2

Classify Serialization Depth

Code

#3

Has Corrupted Field?

If

#4

Tag Corrupted Route

Set

#5

Tag Recoverable Route

Set

#6

Merge Branches

Merge

#7

Build Single Report

Code

#8

Final Report Output

No Op

#9

Note Stages

Sticky Note

#10

Note Classifier

Sticky Note

#11

Note Routing

Sticky Note

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