These days you can use JSON aggregation in the database to avoid returning duplicate data in what would otherwise be large joins.