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

# namesOf

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

## namesOf(obj: Object): Array<String>

Returns an array of strings with the names of all the keys within the given object.

_Introduced in DataWeave version 2.3.0._

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>obj</code></p></td><td><p>The object to evaluate.</p></td></tr></tbody></table>

### Example

This example returns the keys from the key-value pairs within the input object.

#### Source

```DataWeave
%dw 2.0
output application/json
---
{ "namesOf" : namesOf({ "a" : true, "b" : 1}) }
```

#### Output

```JSON
{ "namesOf" : ["a","b"] }
```

## namesOf(obj: Null): Null

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

_Introduced in DataWeave version 2.4.0._
