rename_keys - Liquid Filter Reference
On this page
Description
Renames keys in a map
| Property | Value |
|---|---|
| Return Type | any |
| Category | maps |
Examples
liquid
{{ my_map | rename_keys: "name", "title" | json }}
Output: {"title":"Fido","type":"dog"}
liquid
{{ my_map | rename_keys: "type", "category" | json }}
Output: {"name":"Fido","category":"dog"}
liquid
{{ products | rename_keys: "name", "title" | json }}
Output: [{"title":"Fridgetastic 3000","type":"whitegoods"},{"title":"Coldinator 500","type":"whitegoods"},{"title":"Geronimo 9000","type":"computers"},{"title":"Y2K Amaze","type":"computers"}]