I am going through very strange and small issue. I have one data class which I am using for Json parsing. That data class (Json) has one attribute
val isExpired: Boolean
but after response creation its not taking isExpired as key. It's always changing it to expried.
"expired": false
Are you using Jackson to do the serialization? If so, then the answer would normally be that you need to annotate the property with @JsonProperty("isExpired"). However in the specific case of Boolean properties it's not quite that, as discussed here. So actually what you need to do here is as follows:
data class MyClass(@get:JsonProperty("isExpired") val isExpired: Boolean)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With