arraysjsonduplicateszorbajsoniq

Eliminate duplicates in array (JSONiq)


I'd like to delete duplicates in a JSONiq array.

let $x := [1, 2, 4 ,3, 3, 3, 1, 2, 5]

How can I eliminate the duplicates in $x?


Solution

  • let $x := [1, 2, 4 ,3, 3, 3, 1, 2, 5]
    return [ distinct-values($x[]) ]