Tobias Gronbach
02/19/2022, 1:10 PMoverride suspend fun getInspiringQuotes(): Resource<List<InspiringQuoteRemote>> {
return try {
val quotes = client.get {
url(WordpressRoutes.InspiringQuotes)
}.body<List<InspiringQuoteRemote>>()
Resource.Success(quotes)
} catch (e: Exception) {
Timber.e(e)
Resource.Error(e.localizedMessage)
}
}
This is the json-response I receive. I validated the response with an online tool that said it's a VALID (RFC 8259)
[
{
"quote_author":"Oskar Wilde",
"quote":"Unzufriedenheit ist der erste Schritt zum Erfolg."
},
{
"quote_author":"Winston Churchill",
"quote":"Erfolg haben heißt, einmal mehr aufstehen, als man hingefallen ist."
},
{
"quote_author":"Henry Ford",
"quote":"Erfolg besteht darin, dass man genau die Fähigkeiten hat, die im Moment gefragt sind."
},
{
"quote_author":"Albert Einstein",
"quote":"Der sicherste Ort für ein Schiff ist der Hafen. Doch dafür sind Schiffe nicht gemacht."
}
]
Still I get the following error.
kotlinx.serialization.json.internal.JsonDecodingException: Expected start of the array '[', but had 'EOF' instead
Any idea?Sam
02/19/2022, 1:25 PMexpectSuccess
now defaults to false
?Tobias Gronbach
02/19/2022, 1:48 PMSam
02/19/2022, 1:49 PMTobias Gronbach
02/19/2022, 1:49 PMAleksei Tirman [JB]
02/19/2022, 4:22 PM