Reversible Encoder for Prototype-Colliding JSON Property Names
Loading workflow…
Workflow Description
A self-contained workflow protecting fields whose names collide with Object.prototype members such as toString, constructor, valueOf and hasOwnProperty. A Code node emits fictional demo records; risky records travel as a name/value pair list because a literal constructor key can be dropped while an item moves between nodes. The encoder rebuilds each record inside Object.create(null), walks it with Object.keys and hasOwnProperty.call, produces a tagged wrapper of ordered pairs, restores it again and verifies names, order, types and values. An IF node separates failures, Merge joins branches, and a final Code node returns one aggregated safety report.
How it works
- 1.Manual Trigger fires the workflow with one empty item.
- 2.Load Sample Records emits three records: JIRA-1 as payloadPairs with toString, constructor, valueOf and nested hasOwnProperty; CRM-2 as a clean payload object; BAD-3 with null payload.
- 3.Encode And Verify Round Trip rebuilds the record with Object.create(null), encodes tagged pairs, flags colliding own properties, restores and verifies the round trip.
- 4.If Round Trip Valid routes roundTripValid=true to output 0 and failures to output 1.
- 5.Set nodes add status=valid or status=failed with includeOtherFields:true; NoOp keeps failed records.
- 6.Merge appends both branches through separate inputs.
- 7.Build Safety Report runs once for all items and returns one report with totals, sensitive paths and failures.
Use cases
- Processing Jira responses containing a literal toString field
- Normalising CRM records without losing unusual field names
- Auditing unknown JSON schemas for dangerous property names
- Quarantining records that fail encode/restore verification
Requirements
- n8n version 2.48.7
- Nodes: Manual Trigger v1, Code v2, If v2.2, Set v3.4, Merge v3.2, NoOp v1
- No credentials or external calls
- Input with json.payload as an object or json.payloadPairs as a pair list
Setup and testing in n8n
- Import the JSON and click Execute Workflow.
- Confirm a single output item with totalRecords=3, validRecords=2, failedRecords=1, totalSensitiveProperties=4.
- Confirm JIRA-1 has roundTripValid=true and four sensitive paths including $.constructor.
- Confirm BAD-3 appears in failures with originalPayload=null.
- Edge case: return an empty array from the sample node; the flow emits one failure record stating no input items were received.
- For production replace the sample node with your source using the same schema.
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 (9)
Manual Trigger
Manual Trigger
Load Sample Records
Code
Encode And Verify Round Trip
Code
If Round Trip Valid
If
Mark Encoded Valid
Set
Mark Encoding Failed
Set
Keep Failed For Report
No Op
Merge Branches
Merge
Build Safety 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