Play Framework:如何将 List 转换为 JsArray

Play Framework: How to convert a List to a JsArray

鉴于以下 List...

val list = List("one", "one", "two", "two", "three", "three")

...如何将其转换为这样的 JsArray

["one", "two", "three"]

如您所见,我还需要删除重复项。

根据documentation应该是这样的:

import play.api.libs.json._

Json.toJson(List("one", "one", "two", "two", "three", "three").distinct)