Categories

JSON Key Renamer

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

Key Facts

Category
Data Processing
Input Types
textarea, select, number, checkbox
Output Type
json
Sample Coverage
4
API Ready
Yes

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.

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.

Examples

1. API Response Normalization

Frontend Developer
Background
An external API returns data with inconsistent naming, mixing camelCase and PascalCase, which breaks the frontend state management.
Problem
Need to standardize all keys to snake_case for consistency with the backend database.
How to Use
Paste the API response into the JSON Input, select 'Case Conversion' as 'snake_case', and process the data.
Outcome
All keys are automatically converted to snake_case, ensuring the frontend can consume the data without further modification.

2. Batch Key Refactoring

Data Engineer
Background
A large JSON configuration file uses outdated key names that need to be updated to match a new system specification.
Problem
Manually renaming hundreds of keys is error-prone and inefficient.
How to Use
Use the 'Custom Rules' mode to provide a JSON mapping of old keys to new keys, then run the tool.
Example Config
{"oldKeyName": "new_key_name", "userProfile": "user_account"}
Outcome
The tool performs a bulk update of all specified keys while preserving the original values and structure.

Try with Samples

json

Related Hubs

FAQ

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.

API Documentation

Request Endpoint

POST /en/api/tools/json-key-renamer

Request Parameters

Parameter Name Type Required Description
jsonInput textarea Yes -
renameMode select Yes -
renameRules textarea Yes -
caseConversion select Yes -
maxDepth number No -
includeArrays checkbox No -
handleConflicts select Yes -
preserveOriginal checkbox No -

Response Format

{
  "key": {...},
  "metadata": {
    "key": "value"
  },
  "error": "Error message (optional)",
  "message": "Notification message (optional)"
}
JSON Data: JSON Data

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-json-key-renamer": {
      "name": "json-key-renamer",
      "description": "Batch rename JSON object keys with support for patterns, rules, and transformations. Perfect for API response formatting and data normalization.",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=json-key-renamer",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

If you encounter any issues, please contact us at [email protected]