[英]Json4s seems to return quotes when dealing with strings, how can I force Json4s to just return the value?
如果我使用类似的东西:
{company: {name: "Some Person"}}
然后我使用:
compact(render(json \ "company" \ "name"))
我会回来:
"Some Person"
任何方式回来:
Some Person
不做一些子串?
使用extract
scala> (json \ "company" \ "name").extract[String]
res4: String = Some Person
必要的进口是
import org.json4s._
import org.json4s.jackson.JsonMethods._
并在代码中
implicit val formats = DefaultFormats
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.