1
I’m using Gson to work with json, let’s say I have this class
class Track(
@SerializedName("id") val id: Long,
@SerializedName("name") val name: String,
@SerializedName("modality") val modality: String,
@SerializedName("paper") val paper: Int,
@SerializedName("popper") val popper: Int,
@SerializedName("plate") val plate: Int,
@SerializedName("disappear") val disappear: Int,
@SerializedName("minRound") val minRound: Int,
@SerializedName("penalty") val penalty: Int,
@SerializedName("maxPoint") val maxPoint: Int,
@SerializedName("order") val order: Int)
and I’m using it to catch all the tracks
val trackType = object : TypeToken<List<Track>>() {}.type
val modalities = Gson().fromJson<List<Track>>("json", trackType)
the more it brings me all the fields, as I do to type filter only type to get the id and the name?