让我说我有......
val obj: MongoDBObject = getDbObj
println(obj)
打印出来:
{ "_id" : "1234", "name":"Kevin", "age":"100" }
如何将obj
转换为JsValue
?
答案 0 :(得分:2)
这就是Play 2.1(documentation)
的用法val dbo = MongoDBObject("id" -> "0001", "name" -> "Kevin", "age" -> "100")
val json: JsValue = Json.parse(dbo.toString)