package ru.omni_devel.cards import kotlinx.serialization.Serializable import org.json.JSONArray @Serializable class CardIcon( val names: LinkedHashMap, val iconId: String? = null ) { companion object { fun parseIconsDataFromJson(json: String): List { val array = JSONArray(json) val icons = mutableListOf() for (i in 0 until array.length()) { val obj = array.getJSONObject(i) icons.add(CardIcon( names = jsonObjectToMap(obj.getJSONObject("names")), iconId = if (obj.has("iconId")) obj.getString("iconId") else null )) } return icons } } }