I'm using Gson to work with json, let's say it has 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)
I'm using this to get all Tracks
val trackType = object : TypeToken<List<Track>>() {}.type
val modalities = Gson().fromJson<List<Track>>("json", trackType)
But it brings me all the fields, how do I sort just type sort to get id and name?