【发布时间】:2013-11-11 15:48:03
【问题描述】:
嘿,我遇到了一个基于杰克逊反序列化的问题,这是我尝试过的以及我得到的错误。
错误 : com.fasterxml.jackson.core.JsonParseException: Unexpected character ('}' (code 125)): 期待双引号开始字段名称
Java 代码
List<Contact> ds = mapper.readValue(data, mapper.getTypeFactory().constructCollectionType(List.class, Contact.class));
//OR this one
List<Contact> ds = mapper.readValue(data, new TypeReference<List<Contact>>() {});
我的 JSON
[
{
"id": "200",
"name": "Alexia Milano",
"email": "minalo@gmail.com",
"prenom": "xx-xx-xxxx,x - street, x - country",
}, {
"id": "201",
"name": "Johnny Depp",
"email": "johnny_depp@gmail.com",
"prenom": "xx-xx-xxxx,x - street, x - country",
}
]
【问题讨论】: