rename-json-keys

03 · Nested

The same idea works through nested objects and arrays.

Input

{
  "customer": {
    "first_name": "John",
    "address": { "zip_code": "533001" }
  },
  "items": [
    { "item_name": "Pen" },
    { "item_name": "Book" }
  ]
}

Mapping

{
  "customer": {
    "first_name": "name",
    "address": { "zip_code": "postal_code" }
  },
  "items": { "item_name": "name" }
}

The transformation recursively follows the JSON structure, including objects inside arrays.

Next: advanced mapping →