https://kotlinlang.org logo
#serialization
Title
# serialization
t

Tower Guidev2

10/25/2023, 1:30 PM
Hi is it possible to deseriaize this dynamic json using a custom serialiser? the json response from a paricular backend api can take either of these formats
[
{
"success":true,
"code":200,
"data":{
"id":"366fe7e7-c1ea-3bc9-9e05-cd87afcf0252",
"starred":true
}
}
]
or
[
{
"success":false,
"code":503,
"data":{
"id":{
"id":"366fe7e7-c1ea-3bc9-9e05-cd87afcf0252",
"data":{
"id":"366fe7e7-c1ea-3bc9-9e05-cd87afcf0252",
"starred":true
}
},
"message":"Request was not completed within timeout duration"
}
}
]
meaning that "id" can be a string or complex object
4 Views