okcore / winkit.android.okcore / CoreController / mapJsonArray

mapJsonArray

protected fun <T> mapJsonArray(jsonArray: JSONArray, callback: (json: JSONObject) -> T): List<T>

Util’s method to map a JSONArray to a model class list in a simple way

example: val parsedList: List<Model> = mapJsonArray(jsonArray, { json -> Model(json) }

Parameters

jsonArray - to map

callback - tha mapper function

Return the parsed list