The deepmerge task folds two or more objects together to create a single object. When a conflict occurs, the value from the last merged object takes precedence. The task allows combining objects — for example, parts of a service instance into an object representing a whole service instance — and can create new data structures to match an existing task’s parameters, enabling reuse of existing tasks without new programming.
A deepmerge task can combine data from job variables, static data, and tasks’ outgoing variables. This task only operates on objects — it does not operate on numbers, booleans, strings, or arrays.
When merge conflicts occur, the conflicting key’s value in the last merged object is used. The deepmerge task merges elements at any depth.
Object 1
Object 2
Object 3
Result
Object 1
Object 2
Object 3
Result
When the same key exists in both objects with different scalar values, the last object’s value wins.
Object 1
Object 2
Result
When the same key exists in both objects with array values, the last object’s array replaces the first.
Object 1
Object 2
Result
When the same key exists in both objects but the array items have different keys, the items are merged.
Object 1
Object 2
Result