Grouping Data by categoryId with JSONata

54 Views Asked by At

The challenge arises when some entries have multiple categoryIds, resulting in difficulties in proper grouping

I was able to group the data with the '$distinct' method, but some of the data has more than one categoryId, which causes problems in grouping. How can I group categoryIds that are an array?

JSONata: https://try.jsonata.org/79QRdDXs9

1

There are 1 best solutions below

1
Jignesh Gothadiya On

You should create on map for categoryId as key and object of data as value.