leandro
09/13/2019, 10:40 AMJson.nonstrict
with Retrofit 2.6.1.
The field is a String, and with it on my class I receive the message:
Field 'full_name' is required, but it was missing
but if I remove it then I get:
Encountered an unknown key full_name
leandro
09/13/2019, 10:42 AMbuild/classes/kotlin/main/
leandro
09/13/2019, 10:42 AMsandwwraith
09/13/2019, 11:11 AMleandro
09/13/2019, 11:14 AM@Serializable
data class AuthResponse(
@SerialName("full_name") val full_name: String,
@SerialName("token") val token: String
)
sandwwraith
09/13/2019, 11:19 AMsandwwraith
09/13/2019, 11:20 AMleandro
09/13/2019, 11:20 AMprettyPrint = true
to my json configuration shows itleandro
09/13/2019, 11:23 AMJson.plain
I also get the same error. On this case I added a new field to the deserialized model due to its strictness but that’s not need on the client app.leandro
09/13/2019, 11:23 AM0.13.0
sandwwraith
09/13/2019, 11:34 AMval input = """{"full_name":"A","token":"B"}"""
println(Json.nonstrict.parse(AuthResponse.serializer(), input))
println(Json.parse(AuthResponse.serializer(), input))
leandro
09/13/2019, 11:57 AMsandwwraith
09/13/2019, 11:58 AM