我有一个JSON文件看起来像这样:如何反序列化以Jackson的数组开头的JSON文件?
[
{ "field":"val" },
....
]
我代表他们的单个对象和集合Java对象:
public class Objects{
public Collection<List> myObject;
}
我想用ObjectMapper
反序列化JSON。
ObjectMapper mapper = new ObjectMapper();
mapper.readValue(in, Objects.class);
,但我得到:
11-24 23:19:19.828: W/UpdateService(6084): org.codehaus.jackson.map.JsonMappingException:
Can not deserialize instance of com.project.my.Objects out of START_ARRAY token