unique()

If the value of the expression is an array, this function returns an array of nested elements. If it takes a single value as an argument, it returns an array containing only one element.

Syntax

unique(EXPR)
Required Parameters
EXPR
Expression to return an array to remove nested elements. The order of the arrays returned at this time is not guaranteed. If the expression is a scalar value, the function returns an array containing only one element. If the expression is null, it returns null.

Usage

json "{}" | eval array=unique(array(1, 1, 2, "2")) => ["2", 1, 2]