Skip to content
AI Agents

Recursive Nested JSON Key Rename with Preserved-Keys Manifest

6 nodes 77 8 Manual trigger
Download

Loading workflow…

Workflow Description

A fully local workflow: a manual trigger feeds a fictional 3-level nested sample, a Code node recursively applies an editable rename dictionary at every depth while preserving unmapped keys and building a path manifest of renamed vs preserved keys. The algorithm detects name collisions (target key already exists) and never silently overwrites values — collisions are recorded instead. An If node compares total key counts before and after (17/17) to detect silent loss, and a Set node appends a readable report retaining all fields.

How it works

  1. 1.Run the manual trigger to emit the fictional nested sample
  2. 2.Rename Engine applies the dictionary recursively over objects and arrays
  3. 3.The engine collects a manifest of renamed, preserved and conflicting key paths
  4. 4.If compares original vs new total key counts and routes true or false
  5. 5.Set adds a text report keeping all other fields; a sticky note documents the dictionary

Use cases

  • Normalizing hierarchical API responses before storage
  • Renaming integration field names without data loss
  • Auditing schema transformations with a reviewable manifest

Requirements

  • No credentials; all processing is local
  • For real input remove the sample node and feed same-schema data into Rename Engine
  • Edit RENAME_MAP inside the Rename Engine Code node

Setup and testing in n8n

  1. Import the workflow in n8n and click Execute Workflow
  2. Verify the manifest and the 17/17 key count (7 renamed, 10 preserved) on the true branch
  3. Replace the sample value with a string or null to see the invalid item routed to Flag Silent Loss
  4. Add a pre-existing 'town' key to the sample to prove collision detection in manifest.conflicts without silent overwrite
  5. Add a dictionary entry and rerun to confirm renaming at all levels

Service Value

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

Apps Used

Manual Trigger Code If Set

Details

Trigger Manual trigger
Nodes 6
Apps 4
Views 77
Downloads 8

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

Manual Trigger

Manual Trigger

#1

Load Fictional Sample

Code

#2

Rename Engine

Code

#3

Key Counts Match

If

#4

Format Final Report

Set

#5

Flag Silent Loss

Set

#6

Dictionary & Setup Guide

Sticky Note

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