---
title: Bulk Rename of Keys
date: 2025-12-30T05:37:48Z
modified: 2026-06-12T09:11:12Z
permalink: "https://ezintegrations.ai/docs/rename-multiple-json-keys/"
type: docs
status: publish
excerpt: ""
wpid: 3077
doc_category:
  - Pycode Examples
author: Arun Thakur
---

## Overview

The Bulk Rename of Keys feature enables users to rename multiple columns dynamically using Python Operations in eZintegrations. While the built-in rename operation is suitable for individual fields, Python-based renaming provides a scalable approach for handling large datasets.

This method is particularly useful for applying consistent naming conventions, such as adding prefixes to multiple keys within an array of dictionaries.

---

## When to Use

Use this approach when multiple columns must be renamed simultaneously using a common pattern.

- Adding prefixes or suffixes to multiple fields
- Standardizing column naming conventions
- Preparing datasets for downstream integrations
- Handling dynamic or variable schemas
- Improving data consistency across pipelines

---

## How It Works

The Python script retrieves the dataset items from the integration response and iterates through each record.

For every key in each record, a prefix is prepended to generate a new column name. The original dataset is then updated with the renamed keys.

---

## Python Code for Renaming Multiple Columns

The following script demonstrates how to prepend a prefix to all column names inside a dataset.

📋Responsedata = []

new_data = pycode_data
prefix = "billTo_"

# Extract items from the dataset response
items = new_data["bizdata_dataset_response"]["items"]

updated_items = []

# Iterate through the items and rename each column by adding the prefix
for item in items:
    updated_item = {}
    for key, value in item.items():
        new_key = f'{prefix}{key}'  # Add the prefix to each column name
        updated_item[new_key] = value
    updated_items.append(updated_item)

# Update the original dataset with the renamed columns
new_data["bizdata_dataset_response"]["items"] = updated_items

pycode_data = new_data


---

## Key Parameters

The following parameters control the behavior of the bulk renaming process.



| Parameter | Description |
| --- | --- |
| prefix | Defines the text added before each column name (for example, billTo\_). |
| items | Represents the dataset records located under bizdata\_dataset\_response. |

---

## How to Use

Follow these steps to rename multiple keys using Python Operations.

1. Configure the integration to return data in the bizdata\_dataset\_response format.
2. Open the Python Operation editor.
3. Paste the bulk renaming script.
4. Modify the prefix value as required.
5. Save and deploy the workflow.
6. Test the operation with sample data.

---

## Use Case Example

This method is useful when standardizing billing or customer-related datasets.

- Original Key: name
- Renamed Key: billTo\_name
- Original Key: address
- Renamed Key: billTo\_address
- Result: Consistent prefixed fields

---

## Troubleshooting

- Ensure the bizdata\_dataset\_response and items keys exist in the input.
- Verify that items contains a list of dictionaries.
- Check for null or empty datasets.
- Confirm that pycode\_data is correctly assigned.
- Review logs if renamed fields are missing.

---

## Frequently Asked Questions

 ### 1. What is the purpose of bulk renaming?

 Bulk renaming allows users to apply consistent naming conventions to multiple columns in a single operation.

 

 

  ### 2. Can I change the prefix value?

 Yes. The prefix variable can be modified to match specific naming requirements.

 

 

  ### 3. Does this script remove original keys?

 Yes. The script replaces the original keys with prefixed keys in the output dataset.

 

 

  ### 4. Can I add a suffix instead of a prefix?

 Yes. You can modify the new\_key assignment to append text after the key name.

 

 

  ### 5. Is this method suitable for large datasets?

 Yes. This approach scales effectively for datasets with many columns and records.

 

 

 ---

## Notes

- This method assumes a consistent dataset structure.
- Backup original data before applying bulk transformations.
- Follow organizational naming standards.
- Test changes in a staging environment before production use.

## Topics

**Docs Categories:** [Pycode Examples](https://ezintegrations.ai/wp-content/uploads/wp-mfa-exports/taxonomy/doc_category/pycode-examples.md)