make_object

Description

Turn a sequence of name:value elements into an object. Without arguments, returns an empty, non-null object literal.

Return type

object

Domain

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

Categories

Usage

make_object([ options ], [ key_value_1, key_value_2, ... ])

Argument

Type

Optional

Repeatable

Restrictions

options

options

yes

no

constant

key_value

storable

yes

yes

none

Options

Option

Type

Meaning

keep_nulls

bool

Determines whether key-value pairs with null values are kept in the object (true) or discarded (false). Default is false (discard).

Examples

make_col obj:make_object(label:"speed", value:distance/(endtime-starttime), attime:endtime)

Make a new column ‘obj’ consisting of an object with keys ‘label’, ‘value’, and ‘attime’.

make_col obj:make_object()

Make a new column ‘obj’ consisting of an empty object that is not ‘null’.

make_col obj:make_object(options(keep_nulls:true), 'apple':string_null())

Make a new column ‘obj’ consisting of an object {"apple": null}.

Aliases

makeobject (deprecated)