Question: suspend fun boroughsMapper ( jsonObj: JSONObject, localAssetsProvider: com.example.knownyc.data.local.provider.AssetsProvider, ) : List { val jsonArray:JSONArray = jsonObj.getJSONArray ( boroughs ) val boroughs:MutableList = mutableListOf
suspend fun boroughsMapper
jsonObj: JSONObject,
localAssetsProvider: com.example.knownyc.data.local.provider.AssetsProvider,
: List
val jsonArray:JSONArray jsonObj.getJSONArrayboroughs
val boroughs:MutableList mutableListOf
for i: Int in until jsonArray.length
val obj: JSONObject jsonArray.getJSONObjecti
val borough Borough
boroCode obj.getStringboroughfirst
name obj.getStringshortName
longName obj.getStringfullName
image localAssetsProvider.getDrawableResourceIdobjgetStringimageFilename
boroughs.addborough
return boroughs
i want to write the similar class to this called parksMapper. it looks similar to this but instead of data coming from localassestprovider it comes from NycParkResponse data class
@Serializable
data class NycParksResponse
@SerialNamevalue "signname"
val signName : String?,
val location : String?,
val url : String?,
this is my NycParkResponse data class how can i pass this to the object in a mapper can you please write a mapper class similar to boroughMapper class
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
