I have this error:
JSON parse error: Cannot deserialize instance of
com.asc.skyalign.service.dto.TaskDataDTO
out of START_ARRAY token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance ofcom.asc.skyalign.service.dto.TaskDataDTO
out of START_ARRAY token\n at [Source: (PushbackInputStream); line: 10, column: 21] (through reference chain: com.asc.skyalign.service.dto.WorkOrderDTO["taskDataList"])
When post Json
API, this is my request :
{
"siteLocationLat": "35.123415",
"workOrderID": "WO-1rmrud5gkdj4r0n6",
"siteId": "NNA-12312312311",
"siteAcessNotes": "No notes",
"siteLocationLong": "128.910283984",
"assignedTo": "ibrahem@test.com",
"timeStamp": 1596738379102,
"email": "ibrahem@test.com",
"taskDataList": [
{
"roll": "2.0",
"azimuth": "120.0",
"tilt": "9.0",
"sectorLocationLat": "35.123451",
"amtImei": "35800121213",
"wakeuUpInterval": "1440",
"sectorID": "NNA-12312312311-1",
"sectorLocationLong": "128.123123",
"taskName": "Install AMT Sector A",
"taskDescription": "Install AMT on Back of the Antenna"
}
]
}
My WorkOrderDto
is:
public class WorkOrderDTO implements Serializable {
private List<TaskDataDTO> taskDataList=new ArrayList<TaskDataDTO>();
public List<TaskDataDTO> getTaskDataList() {
return taskDataList;
}
public void setTaskDataList(TaskDataDTO taskDataDTO) {
this.taskDataList.add(taskDataDTO);
}
}
and my WorkOrder Entity is :
public class WorkOrder implements Serializable {
private List<TaskData> taskDataList=new ArrayList<TaskData>();
public List<TaskData> getTaskDataList() {
return taskDataList;
}
public void setTaskDataList(TaskData taskData) {
taskDataList.add(taskData);
}
}
when run my application and request the api and before arrived my controller i see this Exception in postman body :
JSON parse error: Cannot deserialize instance of
com.asc.skyalign.service.dto.TaskDataDTO
out of START_ARRAY token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance ofcom.asc.skyalign.service.dto.TaskDataDTO
out of START_ARRAY token\n at [Source: (PushbackInputStream); line: 10, column: 21] (through reference chain: com.asc.skyalign.service.dto.WorkOrderDTO["taskDataList"])
and this error in Java Idea terminal :
Bad Request: JSON parse error: Cannot deserialize instance of
com.asc.skyalign.service.dto.TaskDataDTO
out of START_ARRAY token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance ofcom.asc.skyalign.service.dto.TaskDataDTO
out of START_ARRAY token at [Source: (PushbackInputStream); line: 10, column: 21] (through reference chain: com.asc.skyalign.service.dto.WorkOrderDTO["taskDataList"])