apoc.map.renameKey
Function Apoc Extended
Rename the given key(s) in the MAP
.
Signature
apoc.metrics.get(map :: MAP?, keyFrom :: STRING?, keyTo :: STRING?, config = {} :: MAP?) :: MAP?
Input parameters
Name | Type | Default |
---|---|---|
map |
MAP? |
null |
keyFrom |
STRING? |
null |
keyTo |
STRING? |
null |
config |
MAP? |
{} |
Configuration parameters
name | type | default | description |
---|---|---|---|
recursive |
boolean |
true |
searches for keys to rename even within submaps or sublists of maps |
Usage Examples
apoc.map.renameKey (default config)
WITH {
old_key: [1, "test", {old_key: "some_value"}],
otherKey: [1, ["test", {old_key: "some_value"}]],
name: {old_key: "some_value"},
other: "key"
} AS map
RETURN apoc.map.renameKey(map, "old_key", "new_key") as value
value |
---|
|
apoc.map.renameKey (with config
recursive: false
)WITH {
old_key: [1, "test", {old_key: "some_value"}],
otherKey: [1, ["test", {old_key: "some_value"}]],
name: {old_key: "some_value"},
other: "key"
} AS map
RETURN apoc.map.renameKey(map, "old_key", "new_key", {recursive: false}) as value
value |
---|
|