I'm trying to retrieve data from an api. The JSON response looks like this
{
"result":"success",
"documentation":"https://www.exchangerate-api.com/docs",
"terms_of_use":"https://www.exchangerate-api.com/terms"
"supported_codes":[
["AED","UAE Dirham"],
["AFN","Afghan Afghani"],
["ALL","Albanian Lek"],
["AMD","Armenian Dram"],
["ANG","Netherlands Antillian Guilder"],
["AOA","Angolan Kwanza"],
["ARS","Argentine Peso"],
["AUD","Australian Dollar"],
["AWG","Aruban Florin"],
["AZN","Azerbaijani Manat"],
["BAM","Bosnia and Herzegovina Convertible Mark"],
["BBD","Barbados Dollar"] etc. etc.
]
}
And this is the dataclass I have for it.
CurrencyResponse.kt
package com.example.currencyconverter.data
import com.squareup.moshi.Json
data class CurrencyResponse(
@Json(name="supported_codes") var supported_codes: List<Codes>
) {
data class Codes(
@Json(name="0") var currency_code: String
) {
}
}
Yet I'm still getting the error mentioned in the title. Any help is greatly appreciated
>` or maybe use a custom serializer.
– broot Oct 25 '21 at 21:52