score:0

Accepted answer

roughly something like this:

val items =
  GroupItems.join(Items).on(_.itemId === _.id).run // <- query fetching items with group_ids
            .groupBy(_._1.groupId).toMap
            .mapValues(_._2) // <- mapping Map values to only items

// render groups to json and add a field items with the items (I may be wrong about Play's json api names)
val json = Group.run.map(g => Json.toJson(g) ++ JsObject("items" -> Json.toJson(items(g.id))))

Related Query

More Query from same tag