DEEP_MERGE

Creates a new object by recursively merging two or more objects together. Where there are key collisions that last value is used.

Syntax 

DEEP_MERGE(object, object, ...)

Examples 

Example 1

Input

{
  "object_1": {
    "location": {
      "city": "Dublin"
    }
  },
  "object_2": {
    "location": {
      "country": "Ireland"
    }
  }
}

Formula

DEEP_MERGE(object_1, object_2)

Output

{
  "location": {
    "city": "Dublin",
    "country": "Ireland"
  }
}
Example 2

Input

{
  "object_1": {
    "location": {
      "city": "Dublin"
    }
  },
  "object_2": {
    "location": {
      "city": "Cork"
    }
  }
}

Formula

DEEP_MERGE(object_1, object_2)

Output

{
  "location": {
    "city": "Cork"
  }
}
Was this helpful?