Skip to main content

JSON_ARRAY_DISTINCT

Introduced or updated: v1.2.644

Removes duplicate elements from a JSON array and returns an array with only distinct elements.

Syntax

JSON_ARRAY_DISTINCT(<json_array>)

Return Type

JSON array.

Examples

SELECT JSON_ARRAY_DISTINCT('["apple", "banana", "apple", "orange", "banana"]'::VARIANT);

-[ RECORD 1 ]-----------------------------------
json_array_distinct('["apple", "banana", "apple", "orange", "banana"]'::VARIANT): ["apple","banana","orange"]
Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today