'Retrofit Http request returns a forbidden field name

Android, Retrofit request returns something like this

"image": [{
"size": "small",
"#text":"https://lastfm.freetls.fastly.net/i/u/34s/3b54885952161aaea4ce2965b2db1638.png"
}]

I require the size and the #text fields but producing this data class is not allowed i.e.

data class Image(
val #text: String,
val size: String)

Is there an alternative way to get the #text field



Solution 1:[1]

data class Image(
 @SerializedName("#text") val text: String,
 @SerializedName("size") val size: String)

If you are using gson as converter factory in Retrofit.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 sohel yadav