Extracts the key values from an Object data type column and stores them in an array of String values.

Column reference example:

keys('object1')

Output: Returns an array of all of the keys found in the key-value Objects found in the object1 column.

keys(obj_col)


ArgumentRequired?Data TypeDescription
obj_colYString or ObjectName of column or Object literal whose keys are to be extracted into an array

obj_col

Object literal or name of the Object column whose keys you want to extract into an array.

Required?Data TypeExample Value
YesObject literal or column referencemyObj

Example - Basic keys example

Source:

Following dataset contains configuration blocks for individual features. These example blocks are of Object type.

Code formatting has been applied to the Object data to improve legibility.

FeatureNameConfiguration
Whiz Widget
{
 "enabled": "true",
 "maxRows": "1000",
 "maxCols": "100"
}
Magic Button
{
 "enabled": "false",
 "startDirectory": "/home",
 "maxDepth": "15"
}
Happy Path Finder
{
 "enabled": "true"
}

Transformation:

The following transformation extracts the key values from the Object data in the Configuration column.

Results:

The keys_Configuration column contains the arrays of the key values.

FeatureNameConfigurationkeys_Configuration
Whiz Widget
{
 "enabled": "true",
 "maxRows": "1000",
 "maxCols": "100"
}
["enabled","maxRows","maxCols"]
Magic Button
{
 "enabled": "false",
 "startDirectory": "/home",
 "maxDepth": "15"
}
["enabled","startDirectory","maxDepth"]
Happy Path Finder
{
 "enabled": "true"
}
["enabled"]

Example - Create an Object of product properties