I'm surprised they didn't mention SQL Server's "FOR JSON", which doesn't solve the problem they're solving entirely (n:n cannot be deduplicated AFAIK) but it can get you 90% of the way
https://learn.microsoft.com/en-us/sql/relational-databases/j...
(I can't help but wonder if this whole thing would be a lot better if SQL had a more first-class concept of sum types...)