2
嘗試從自述文件https://github.com/json4s/json4s#linq-style 中的示例運行以下測試,但我得到一個空列表。我沒有在示例中指定的結果列表(5,3)Json4s'linq-style'爲理解提供空列表
test("JValue with for comprehension") {
import org.json4s._
import org.json4s.native.JsonMethods._
val json = parse("""
{ "name": "joe",
"children": [
{
"name": "Mary",
"age": 5
},
{
"name": "Mazy",
"age": 3
}
]
}
""")
val result = for {JField("age", JInt(age)) <- json} yield age
println(result)
//Output : List()
}