Есть подсказки, почему?
JSON Response< /p>
Код: Выделить всё
[
{
"dateCreated": "07-22-2021",
"comments": "Comment",
"vehicle_type": "Sedan",
"name": "Leagacy Nissan Template",
"template-type": "", //this is giving me the problem
"template_uses_type": "Both"
...
}
]
Код: Выделить всё
@Serializable
data class SpinDataResponse(
val dateCreated:String,
val comments: String,
val vehicle_type:String,
val name:String,
@SerializedName("template-type") val template_type:String,
val template_uses_type:String,
...
)
I/System.out: Ошибка: неожиданный токен JSON по смещению 120: обнаружен
неизвестный ключ «тип шаблона».
Используйте «ignoreUnknownKeys = true» в конструкторе «Json {}», чтобы игнорировать неизвестные ключи.
Ввод JSON: ...."name": "Nissan PathFinder", "template-type": "", "template_.....
Я не хочу игнорировать неизвестный ключ, потому что я на самом деле это нужно.
Подробнее здесь: https://stackoverflow.com/questions/702 ... ot-working
Мобильная версия