Function: map.merge_nested

Takes two maps, creates a copy of the first map, and recursively adds items from the second map to the copy.

For maps with the same key, the value from the first map is replaced by the value from the second map.

For example, if you have map1 = {key1: value1} and map2 = {key1: value2}, map.merge_nested(map1, map2) returns {key1: value2}.

For nested maps, values are merged recursively.

For example, if you have map1 = {key1: {keyx: valuex}} and map2 = {key1: {keyy: valuey}}, map.merge_nested(map1, map2) returns {key1: {keyx: valuex, keyy: valuey}}.

Arguments

Arguments
first The map to be merged into.
second The map to merge.

Returns

A copy of the first map with items added from the second map.

Raised exceptions

Exceptions
TypeError If first or second is not a map (dictionary).

Examples

You can use this function in an expression like this:

${map.merge_nested(first, second)}