I have a JSON like below.
{
"code": "success",
"response": {
"data": {
"xyz": "abc.pdf",
"abc: "efgh.pdf"
}
},
"message": "Files downloaded Successfully"
}
Inside data in the response object, the key is dynamic (xyz, abc etc). I am using Moshi in the retrofit converter. My data classes are as follows.
data class RestResponse<T> (
val code: String,
val message: String,
val response: T
)
data class ProposalDownloadResponse(val data: DownloadData)
data class DownloadData(val list: Map<String, String>)
But I am getting null in the list after parsing. Though I have data.
Refrofit function is like below.
@POST
suspend fun downloadProposal(
@Url url: String,
@Header("accessToken") key: String,
@Body flightDetails: FlightDetails,
): GenericResponse<RestResponse<ProposalDownloadResponse>>