docs-v2/content/v2.0/reference/flux/stdlib/experimental/objectkeys.md

789 B

title description menu weight
experimental.objectKeys() function The `experimental.objectKeys()` function returns an array of keys in a specified object.
v2_0_ref
name parent
experimental.objectKeys Experimental
302

The experimental.objectKeys() function returns an array of keys in a specified object.

Function type: Transformation

import "experimental"

experimental.objectKeys(
  o: {key1: "value1", key2: "value2"}
)

// Returns [key1, key2]

Parameters

o

The object to return keys from.

Data type: Object

Examples

Return all keys in an object

import "experimental"

user = {
  firstName: "John",
  lastName: "Doe",
  age: 42
}

experimental.objectKeys(o: user)

// Returns [firstName, lastName, age]