---
schema_version: "1"
id: 1b220cd1641322d4d4075f3a6e202707fe3d333be1d41bf359bab8dfe676eedb
title: --
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.4/dw-core-functions-minusminus.md
canonical_url: https://docs.mulesoft.com/dataweave/2.4/dw-core-functions-minusminus
source_site: docs.mulesoft.com
content_type: documentation
content_hash: e0deb92cfa736c5eee9ad0d7fae18a36c27dc4a54204ec4902ff17f5f110f31c
description: MuleSoft Documentation Site
release: "2.4"
latest: false
---
---
product: DataWeave
version: 2.4
---

# \--

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

## \--<S>(source: Array<S>, toRemove: Array<Any>): Array<S>

Removes specified values from an input value.

This version of `--` removes all instances of the specified items from an array. Other versions act
on objects, strings, and the various date and time formats that are supported by DataWeave.

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>source</code></p></td><td><p>The array containing items to remove.</p></td></tr><tr><td><p><code>toRemove</code></p></td><td><p>Items to remove from the source array.</p></td></tr></tbody></table>

### Example

This example removes specified items from an array. Specifically, it removes all instances of the
items listed in the array on the right side of `--` from the array on the left side of the function,
leaving `[0]` as the result.

#### Source

```DataWeave
%dw 2.0
output application/json
---
{ "a" : [0, 1, 1, 2] -- [1,2] }
```

#### Output

```JSON
{ "a": [0] }
```

## \--<K, V>(source: { (K)?: V }, toRemove: Object): { (K)?: V }

Removes specified key-value pairs from an object.

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>source</code></p></td><td><p>The source object (an <code>Object</code> type).</p></td></tr><tr><td><p><code>toRemove</code></p></td><td><p>Object that contains the key-value pairs to remove from the source object.</p></td></tr></tbody></table>

### Example

This example removes a key-value pair from the source object.

#### Source

```DataWeave
%dw 2.0
output application/json
---
{ "hello" : "world", "name" : "DW" } -- { "hello" : "world"}
```

#### Output

```JSON
{ "name": "DW" }
```

## \--(source: Object, keys: Array<String>)

Removes all key-value pairs from the source object that match the specified search key.

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>source</code></p></td><td><p>The source object (an <code>Object</code> type).</p></td></tr><tr><td><p><code>toRemove</code></p></td><td><p>An array of keys to specify the key-value pairs to remove from the source object.</p></td></tr></tbody></table>

### Example

This example removes two key-value pairs from the source object.

#### Source

```DataWeave
%dw 2.0
output application/json
---
{ "yes" : "no", "good" : "bad", "old" : "new" } -- ["yes", "old"]
```

#### Output

```JSON
{ "good": "bad" }
```

## \--(source: Object, keys: Array<Key>)

Removes specified key-value pairs from an object.

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>source</code></p></td><td><p>The source object (an <code>Object</code> type).</p></td></tr><tr><td><p><code>keys</code></p></td><td><p>A keys for the key-value pairs to remove from the source object.</p></td></tr></tbody></table>

### Example

This example specifies the key-value pair to remove from the source object.

#### Source

```DataWeave
%dw 2.0
output application/json
---
{ "hello" : "world", "name" : "DW" } -- ["hello" as Key]
```

#### Output

```JSON
{ "name": "DW" }
```

## \--(source: Null, keys: Any)

Helper function that enables `--` to work with a `null` value.

_Introduced in DataWeave version 2.4.0._
