elect
06/17/2024, 9:01 AM"classificationItems": [
{
"classificationItem": {
"classificationItemId": {
"guid": "DAA21B11-88B9-4897-A12E-44CD2E3D07CD"
},
"id": "Site",
"name": "",
"description": "",
"children": [
{
"classificationItem": {
...
}
},
...
]
}
},
...
]
where classificationItems
is a list of ClassificationItem wrappers
I'd like to get rid of that wrapper and have classicationItems
a direct list of `ClassificationItems`(and so the children), so I created my own DeserializationStrategy
However I'd still like to avoid manual job and take advantage of automatic parsing when it comes to the classificationItem
object/class, how can I do that?elect
06/17/2024, 9:01 AMval d = object : DeserializationStrategy<Array<ClassificationItem>> {
override val descriptor: SerialDescriptor = listSerialDescriptor<ClassificationItem>()
override fun deserialize(decoder: Decoder): Array<ClassificationItem> =
decoder.decodeStructure(descriptor) {
TODO()
}
}
elect
06/17/2024, 9:04 AMdecoder
, but I have no idea how to access themelect
06/17/2024, 9:07 AMdecoder as JsonDecoder
elect
06/17/2024, 9:15 AMelect
06/17/2024, 9:29 AM@Serializable(with = ClassificationItemListSerializer::class)
val children: List<ClassificationItem> = emptyList()