# MERGE function

## `MERGE` function

| Function Name | Description | Usage | Input parameter | Return value |
|---|---|---|---|---|
| `MERGE` | Merges two JSON variables (objects or arrays). If same value is present in both the variables, the function removes the duplicate value. | `MERGE(value)` | JSON value to merge. | A JSON object or an array. |

## Supported data type


The `MERGE` function supports the following data type:

- JSON

## Example: Merge two JSON objects


**Sample data** : `$var1$ = {"productId": 23} `


**Usage** : `$var1$.MERGE({"productName":"radio"})`
Merge the value `{"productName":"radio"}` with var1.


**Output**: {"productId": 23,"productName": "radio"}

## Example: Merge two JSON arrays


**Sample data** : `$var1$ = ["first", "second", "third"] `


**Usage** : `$var1$.MERGE([4,5])`
Merge the value `[4,5]` with var1.


**Output** : `["first", "second", "third",4,5]`

## Recommendation

- Learn how to add and configure a [Data Mapping task](https://docs.cloud.google.com/application-integration/docs/configure-data-mapping-task.md.txt)