问题描述
我正在测试以下功能:
// https://coderwall.com/p/o--apg/easy-json-un-marshalling-in-scala-with-jackson
def toMap[V](json:String)(implicit m: Manifest[V]): Map[String,V] = fromJson[Map[String,V]](json)
我的最严格测试如下:
test ("testing toMap") {
val expectedMap = Map("a" -> List(1,2),"b" -> List(3,4,5),"c" -> List())
val actualJson = """{"a":[1,2],"b":[3,5],"c":[]}"""
val actualMap = toMap(actualJson)
assert(actualMap == expectedMap)
}
com.fasterxml.jackson.databind.exc.MismatchedInputException:
Cannot deserialize instance of `scala.runtime.nothing$` out of START_ARRAY token at [Source: (String)"{"a":[1,"c":[]}"; line: 1,column: 6]
(through reference chain: com.fasterxml.jackson.module.scala.deser.GenericMapFactoryDeserializerResolver$BuilderWrapper["a"])
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:63)
您知道这里可能缺少什么吗?
谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)