问题
I perform a flatten operation on a Seq[JsValue]
like:
var rows = (response \\ "rows").head.as[List[List[String]]].flatten
to get the following output:
List(AA , BB , CC ,...)
Basically the response I receive from JSON is that way, so extra spaces will be present to the end of all values. What I actually desire for is:
List(AA, BB, CC, ...)
Is it possible to perform any operation before/instead of flatten
to get what I want to achieve? I tried a flatMap
and the results were not too desirable.
来源:https://stackoverflow.com/questions/57484474/operation-on-list-after-flatten