This is an example object that I got:
{ "query1" : [ { "name" : "John", "id" : 1234 }, { "name" : "Rose", "id" : 3214 }, { "name" : "John", "id" : 1234 } ] }
How can I remove the duplicates using group by and array navigation / unboxing?
I tried implementing the group by clause after the where clause but did not get the correct answer
3
Answers
For remove duplicates item from Json object you can use this code:
Result:
It’s possible to do this way, found the answer here:
In JSONiq, you can indeed remove duplicates with a group by and array unboxing, like so:
There is also a generic approach that will work even with unknown fields and more nested values: