```suspend fun main() { val x = getItems1() val ...
# ktor
l
Copy code
suspend fun main() {
	val x = getItems1()
	val y = getItems2()
}

suspend fun getItems1() = httpClient.get<PayloadContainer<Items>>("<https://api.warframe.market/v1/items>").payload

suspend fun getItems2() = httpClient.getUnwrapped<Items>("<https://api.warframe.market/v1/items>")

suspend inline fun <reified PayloadType> HttpClient.getUnwrapped(url: String) =
	get<PayloadContainer<PayloadType>>(url).payload

//for some reason this API wraps all it's payloads in another payload so we need to unwrap 1 layer

data class PayloadContainer<PayloadType>(val payload: PayloadType)
getItems1()
works perfectly fine,
getItems2()
gives me the following error:
Copy code
class java.util.LinkedHashMap cannot be cast to class payload.Items (java.util.LinkedHashMap is in module java.base of loader 'bootstrap'; payload.Items is in unnamed module of loader 'app')
can someone explain the problem? It seems to have to do with type erasure, but shouldn't
reified
prevent that ? Thread in #general