嘿,我遇到了一个基于杰克逊反序列化的问题,这是我尝试过的以及我得到的错误。
错误:com.fasterxml.jackson.core.JsonParseException:意外字符('}'(代码 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",
}
]