All guides

n8n Rename Keys: map AI output fields

Rename existing JSON keys and inspect receiver contracts and regex depth.

AINavWritten / Updated Sources checked
On this page

At a glance

This guide explains one existing-data task from official node documentation. Establish input and receiver contracts, configure parameters and inspect output. Local checks use public synthetic data without running n8n or calling a model.

Checks from input to delivery

  1. Inspect input

    Check fields, formats and receiver prerequisites.

  2. Configure conversion

    Use the documented operation and actual fields.

  3. Inspect output

    Check count, types and boundaries before continuing.

Preserve original input and missing states at each stage.

Define the key mapping first

Prepare an existing JSON item such as answer_text=Public A and request_id=demo. If the receiver needs answer and request_id, define answer_text→answer and preserve the original. Renaming changes keys, without verifying content or converting it to another required type. Inspect missing values and types separately.

Configure explicit key names first

Add a Rename Keys entry with Current Key Name=answer_text and New Key Name=answer. Define multiple mappings individually and inspect whether the destination already contains data. Regex and Replace With support pattern-based renaming. This single-field task requires no regex and keeps the matching scope explicit.

Regex can affect already renamed keys

Case Insensitive controls regex case matching, while Max Depth=-1 is unlimited and 0 is top-level only. The documentation says regex can match already renamed keys, so mappings are not necessarily independent. Inspect top-level and nested samples, destination collisions and final names before enabling it. Do not guess overwrite behavior for unknown collisions.

Inspect names and values before delivery

A local dictionary check modeled one collision-free mapping, confirming answer=Public A, request_id=demo and removal of the old key. It did not run the node or regex implementation. Inspect actual keys, values and nested depth. Stop downstream use on collisions, missing mappings or incompatible value types.

Article sources

Original editorial content; official descriptions and checking suggestions are distinguished.

  1. n8n · Official sources
    View details