Given the following List
...
val list = List("one", "one", "two", "two", "three", "three")
... how do I convert it to a JsArray
like this?
["one", "two", "three"]
As you can see, I also need to drop duplicates.
According to the documentation is should be like this:
import play.api.libs.json._
Json.toJson(List("one", "one", "two", "two", "three", "three").distinct)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With