Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started