This is my JSON Array :-
[
{
"firstName" : "abc",
"lastName" : "xyz"
},
{
"firstName" : "pqr",
"lastName" : "str"
}
]
我的字符串对象中有这个.现在我想将其转换为Java对象,并将其存储在Java对象列表中.e、 g.在学生对象中.
ObjectMapper mapper = new ObjectMapper();
StudentList studentList = mapper.readValue(jsonString, StudentList.class);
My List class is:-
public class StudentList {
private List<Student> participantList = new ArrayList<Student>();
//getters and setters
}
我的学生目标是:-
class Student {
String firstName;
String lastName;
//getters and setters
}
Am I missing something here? I am getting below exception: -
Exception : com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of com.aa.Student out of START_ARRAY token