Contact Free trial Login


mergeWith(T, V): ?

Appends any key-value pairs from a source object to a target object.

If source and target objects have the same key, the function appends that source object to the target and removes that target object from the output.


Name Description


The object to append to the target.


The object to which the source object is appended.


This example appends the source objects to the target. Notice that "a" : true, is removed from the output, and "a" : false is appended to the target.


%dw 2.0
import mergeWith from dw::core::Objects
output application/json
{ "mergeWith" : { "a" : true, "b" : 1} mergeWith { "a" : false, "c" : "Test"} }


"mergeWith": {
    "b": 1,
    "a": false,
    "c": "Test"

mergeWith(Null, T): T

Helper method to make mergeWith null friendly.

mergeWith(T, Null): T

Helper method to make mergeWith null friendly.

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.