【发布时间】:2015-05-12 21:07:56
【问题描述】:
我有一个如下的 json 结构
{
"components":
{
"metadata":[
[
{"component":2},{"component":9}
],
[
{"component":10},{"component":15}
]
]
}
}
而我的 POJO 类是 ()
public class Components {
private List<Metadata> metadata;
// Getters and setters
}
public class Metadata{
private List<String> component;
// Getters and setters
}
我在 ObjectMapper 中遇到如下错误:
"Can not deserialize instance of com.sections.metadata.Metadata out of START_ARRAY token"
谁能帮我纠正我的 POJO 类结构? 由于json是一个二维数组,所以我创建了两个arrayLists, 一个在组件类中,另一个在元数据类中。
提前致谢!
【问题讨论】:
-
使用 Jackson json 库。