Object

Objects can be declared as constants in a flowgraph or variables in user defined functions.

The Object module exposes a single function, described here.

Object.keys

Scan an object containing key/value pairs and return a list of its keys.

Object.keys(object)
Parameter Description Required?
object The object from which to pluck keys Yes

Example

emit -from :0: -limit 1
| put result = Object.keys({'a': 1, 'b': 2})

Object.toString

Returns a string representation of an object.

Object.toString(object)
Parameter Description Required?
object The object to stringify Yes

Example

emit -points [{result: Object.toString({x: 1})}]

Object.values

Scan an object containing key/value pairs and return a list of its values.

Object.values(object)
Parameter Description Required?
object The object from which to pluck values Yes

Example

emit -points [{result: Object.values({'a': 1, 'b': 2})}]
| split result
| sort value
| keep value