You need to call the parseResult method with json data string.
private fun parseResult(data: String) {
var subCategoryArrayList: ArrayList<POJO>
val gson = GsonBuilder().create()
val jsonObject2 = JSONObject(data)
val jsonObject = jsonObject2.getJSONObject("Data")
val keys = jsonObject.keys()
while (keys.hasNext()) {
var keys = keys.next()
if (jsonObject.get(keys) is JSONArray) {
Log.d("key", keys)
val jsonArray = jsonObject.get(keys) as JSONArray
if (jsonArray != null) {
val listType = object : TypeToken<List<WorkoutSubProgramSection>>() {
}.type //subCategoryArrayList = gson.fromJson(jsonArray, listType) }
}
}
}
No comments :
Post a Comment