大神,过年好,又有问题来麻烦你了。今天在使用json解析的时候,发现下列json,不能被正常解析:
{
"categoryPathList": [
[{
"name": "床品"
}, {
"name": "床垫"
}],
[{
"name": "厨房"
}, {
"name": "铁筷"
}],
[{
"name": "休闲饮食"
}, {
"name": "零食"
}],
[{
"name": "大头"
}, {
"name": "茶几"
}]
]
}
我的pojo结构:
public class CategoryPathList {
private String name;
}
-----------------------------------------
public class Root {
private List<CategoryPathList> categoryPathList;
}
日志会打出来:
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Disconnected from the target VM, address: '127.0.0.1:50377', transport: 'socket'
java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map
at org.nutz.mapl.impl.convert.ObjConvertImpl.injectObj(ObjConvertImpl.java:192)
at org.nutz.mapl.impl.convert.ObjConvertImpl.inject(ObjConvertImpl.java:81)
at org.nutz.mapl.impl.convert.ObjConvertImpl.injectCollection(ObjConvertImpl.java:169)
at org.nutz.mapl.impl.convert.ObjConvertImpl.inject(ObjConvertImpl.java:75)
at org.nutz.mapl.impl.convert.ObjConvertImpl.convert(ObjConvertImpl.java:65)
at org.nutz.mapl.Mapl.maplistToObj(Mapl.java:34)
at org.nutz.mapl.impl.convert.ObjConvertImpl.injectObj(ObjConvertImpl.java:220)
at org.nutz.mapl.impl.convert.ObjConvertImpl.inject(ObjConvertImpl.java:81)
at org.nutz.mapl.impl.convert.ObjConvertImpl.convert(ObjConvertImpl.java:65)
at org.nutz.mapl.Mapl.maplistToObj(Mapl.java:34)
at org.nutz.json.Json.parse(Json.java:79)
at org.nutz.json.Json.fromJson(Json.java:58)
at org.nutz.json.Json.fromJson(Json.java:163)