-
-
Notifications
You must be signed in to change notification settings - Fork 180
Closed
Labels
Description
{
"Data": "[{\"LeaveId\":\"9806595202103221\",\"EmpNo\":\"9806595\",\"LeaveType\":\"ANNUAL\",\"DayType\":\"First Half\",\"LeaveDateFrom\":\"03/22/2021\",\"LeaveDateTo\":\"03/22/2021\",\"Remark\":\"test leave\",\"Substitute\":\"132296\",\"ApplyDate\":\"3/18/2021 2:29:07 PM\",\"AllocatedShiftInTime\":\"\",\"AllocatedShiftOutTime\":\"\",\"ShiftAllocationId\":\"\"},{\"LeaveId\":\"9806595202103191\",\"EmpNo\":\"9806595\",\"LeaveType\":\"CASUAL\",\"DayType\":\"First Half\",\"LeaveDateFrom\":\"03/19/2021\",\"LeaveDateTo\":\"03/19/2021\",\"Remark\":\"firebase message test\",\"Substitute\":\"132296\",\"ApplyDate\":\"3/18/2021 9:28:38 AM\",\"AllocatedShiftInTime\":\"\",\"AllocatedShiftOutTime\":\"\",\"ShiftAllocationId\":\"\"}]",
"ID": "200"
}
val data = mapper.readTree(responseString).get("Data").asText()
val leaveList: Array<LeaveDto> =
mapper.convertValue(mapper.readTree(data), Array<LeaveDto>::class.java)
when using retrofit, how can I de-serialize the above JSON response directly to Kotlin data class without manually mapping using ObjectMapper?