尝试从自述文件https://github.com/json4s/json4s#linq-style中的示例运行以下测试, 但我得到一个空列表。我没有在示例中指定的结果 List(5, 3)
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()
}