Jerkson 开始抛出一个我以前从未见过的非常奇怪的错误。
com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class scala.runtime.BoxedUnit and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: scala.collection.MapWrapper["data"])
我正在从 API 解析一些基本数据。我定义的类是:
case class Segmentation(
@(JsonProperty@field)("legend_size")
val legend_size: Int,
@(JsonProperty@field)("data")
val data: Data
)
看起来Data
像:
case class Data(
@(JsonProperty@field)("series")
val series: List[String],
@(JsonProperty@field)("values")
val values: Map[String, Map[String, Any]]
)
任何线索为什么这会触发错误?似乎是 Jerkson 可以处理的简单类。
编辑:样本数据:
{"legend_size": 1, "data": {"series": ["2013-04-06", "2013-04-07", "2013-04-08", "2013-04-09", "2013-04-10", "2013-04-11", "2013-04-12", "2013-04-13", "2013-04-14", "2013-04-15"], "values": {"datapoint": {"2013-04-12": 0, "2013-04-15": 4, "2013-04-14": 0, "2013-04-08":
0, "2013-04-09": 0, "2013-04-11": 0, "2013-04-10": 0, "2013-04-13": 0, "2013-04-06": 0, "2013-04-07": 0}}}}