object_keys

Description

Get an array of top-level keys from an object type field (field names from JSON objects).

See also flatten, flatten_all, flatten_leaves, flatten_single.

Return type

array

Domain

This is a scalar function (calculates a single output value for a single input row.)

Categories

Usage

object_keys(value)

Argument

Type

Optional

Repeatable

Restrictions

value

object

no

no

none

Examples

make_col keys:object_keys(foo)

Given this JSON object in column foo:

foo

{"a":{"aa":1},"b":{"bb":2}}

object_keys produces:

_keys

a

b

It extracts the top level JSON object key names to produce an array in the new column. Column foo will be retained.