Contact Us 1-800-596-4880

namesOf

namesOf(Object): Array<String>

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

Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.

Parameters

Name Description

obj

The object to evaluate.

Example

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

Source

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

Output

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