$ "properties": [
{
"name": "Armour",
"values": [
[
"258",
1
]
],
"displayMode": 0
},...]我有这个JSON数组。
我使用json4s和scala来解析这段代码。
case class Property(
name: String,
values: Option[Option[(String, Int)]] = None,
displayMode: Int
)我为这个块编写case类,但是当得到值时我得到"None“.
在这个例子中我需要得到"258“。我做错了什么?
发布于 2016-05-22 20:27:51
您的Json看起来像在values属性下有一个列表。我想你想要像字典一样的东西,它应该是带花括号的,而不是只有括号。另一件事是,为什么要将其解析为选项[选项(String,Int)]?尝试将其定义为可选的MapString,Int。
发布于 2016-05-22 21:14:28
这个能行吗?
values: List[(String, Int)] = Nilhttps://stackoverflow.com/questions/37378987
复制相似问题