# JSON Key Renamer

Batch rename JSON object keys with support for patterns, rules, and transformations. Perfect for API response formatting and data normalization.

> Canonical page: https://elysiatools.com/en/tools/json-key-renamer

- **Category:** Data Processing

- **Keywords:** json, rename, keys, transform, refactor, batch, pattern, normalize

## Overview

The JSON Key Renamer is a powerful utility designed to batch rename keys within JSON objects and arrays, enabling seamless data normalization and API response formatting through custom rules, regex patterns, or case transformations.

## Inputs

- **JSON Input** (textarea): Enter your JSON object or array...
- **Rename Mode** (select)
- **Rename Rules** (textarea): Enter your renaming rules...
- **Case Conversion** (select)
- **Maximum Depth** (number): Maximum nesting depth to process (0 = unlimited)
- **Include Array Object Elements** (checkbox)
- **Handle Naming Conflicts** (select)
- **Preserve Original Keys in Output** (checkbox)

## When to use

- Standardizing inconsistent API response keys to match your application's internal data models.
- Refactoring large JSON datasets to follow specific naming conventions like snake_case or camelCase.
- Cleaning up nested JSON structures by applying bulk renaming rules across multiple levels of depth.

## How it works

- Paste your JSON data into the input field and select your preferred renaming mode, such as custom rules or pattern matching.
- Define your transformation logic, whether by providing a mapping dictionary, a regex pattern, or selecting a case conversion style.
- Adjust advanced settings like maximum processing depth or conflict handling to ensure the output meets your specific requirements.
- Execute the process to generate the transformed JSON, which you can then copy or download for your project.

## Use cases

- Normalizing API responses from third-party services to match your frontend state structure.
- Preparing legacy JSON data for migration to a new database schema with different naming requirements.
- Automating the cleanup of exported data files to ensure consistent key naming across your data pipeline.

## Frequently asked questions

### Can I rename keys in nested objects?

Yes, the tool processes nested structures. You can specify the 'Maximum Depth' to control how deep into the object the renaming logic should reach.

### What happens if two keys result in the same name after renaming?

You can configure the 'Handle Naming Conflicts' option to either throw an error, skip the renaming, append a suffix number, or override the existing key.

### Does this tool support regex for renaming?

Yes, by selecting 'Pattern Matching' in the Rename Mode, you can use regular expressions to identify and replace key patterns.

### Can I convert all keys to camelCase or snake_case automatically?

Yes, the 'Case Conversion' option allows you to automatically transform all keys to formats like camelCase, snake_case, PascalCase, or UPPER_CASE.

### Does it work with JSON arrays?

Yes, by enabling the 'Include Array Object Elements' option, the tool will apply your renaming rules to objects contained within arrays.

## Related tools

- [JSON Unflattener](https://elysiatools.com/en/tools/json-unflattener): Convert flattened key-value pairs back to nested JSON objects with support for different key formats and data type inference
- [BOM Character Remover](https://elysiatools.com/en/tools/data-bom-remover): Remove BOM (Byte Order Mark) characters from text and file content. Perfect for cleaning up text files that have encoding issues, fixing CSV imports, and preparing data for processing. Features: - Detect and remove UTF-8 BOM (EF BB BF) - Detect and remove UTF-16 BOM (FE FF or FF FE) - Detect and remove UTF-32 BOM (00 00 FE FF or FF FE 00 00) - Support multiple input formats - Visual BOM character display - Detailed detection report - Support for batch text processing Common Use Cases: - Fix CSV file import errors - Clean up text file encoding issues - Prepare data for JSON parsing - Fix XML parsing problems - Resolve API data encoding conflicts - Standardize text data format
- [JSON Key Extractor](https://elysiatools.com/en/tools/json-key-extractor): Extract all keys from JSON objects with multiple output formats. Perfect for analyzing JSON structure, documentation generation, and understanding complex nested objects.
- [Object Key-Value Converter](https://elysiatools.com/en/tools/object-key-value-converter): Convert between different object key-value formats and manipulate object structures
- [JSON Data Lineage Tracer](https://elysiatools.com/en/tools/json-data-lineage-tracer): Trace JSON field paths, derived dependencies, and transformation history to build a field-level lineage graph
- [CSV to JSON Converter](https://elysiatools.com/en/tools/csv-to-json): Convert CSV data to JSON format with customizable parsing options
- [Lodash Online Utility](https://elysiatools.com/en/tools/lodash-online-utility): Run a safe, curated set of Lodash helpers on JSON input.
- [Text to JSON Converter](https://elysiatools.com/en/tools/text-to-json): Convert various text formats to JSON with customizable parsing options

## Samples

- [JSON Samples](https://elysiatools.com/en/samples/json): JSON (JavaScript Object Notation) format examples from simple to complex structures
- [Terraform Plan JSON Samples](https://elysiatools.com/en/samples/terraform-plan-json-samples): Sample Terraform plan JSON files exported from terraform show -json style payloads for dependency visualization and change review
- [Chat Transcript JSON Samples](https://elysiatools.com/en/samples/chat-transcript-json): JSON examples for multi-role chat transcripts
- [Rich Media JSON Samples](https://elysiatools.com/en/samples/rich-media-json): JSON examples for popular rich text editors (TipTap, Quill, Slate)
