I'm trying to do a Get call with Ktor in a multiplatform project. This is the code:
private val client = HttpClient()
fun myCall(callback: (List<Film>) -> Unit) {
viewModelScope.launch {
val result:List<Film> = client.get {
url("https://data.sfgov.org/resource/wwmu-gmzc.json")
}
callback(result)
}
}
Every time I make this request the application closes and I don't receive any message that gives me a clue what's going on. If instead of putting a list Film as the result type I put String then it works and I receive a list of movies, but I want to parse it to my own objects and I am unable.
Is there something wrong with the call?