rename-json-keys

02 · Basic

Three JSON objects. One simple transformation.

Input

{ "first_name": "John", "age": 30, "city": "Kakinada" }

Rename map

{ "first_name": "name", "age": "years", "city": "location" }

Output

{ "name": "John", "years": 30, "location": "Kakinada" }

The mapping describes what each key should become. Values are untouched.

Next: nested JSON →