Could I somehow use JsonTransformingSerializer ins...
# serialization
z
Could I somehow use JsonTransformingSerializer instead for this data class so its simpler?
Copy code
@Serializable
internal data class ElementRenderer<T>(private val newElement: NewElement<T>) {
    val model = newElement.type.componentType.model

    @Serializable
    data class NewElement<T>(val type: Type<T>)

    @Serializable
    data class Type<T>(val componentType: ComponentType<T>)

    @Serializable
    data class ComponentType<T>(val model: T)
}
e
no need for
JsonTransformingSerializer
, this is possible with every format
z
Oh. I was thinking JsonTransformingSerializer since its simpler to implement and for Json. with kserializer I'd have to add some extra stuff like serialize method which I will not be using in my project and having to cast the decoder to use it as Json
Could I implement KSerializer without implementing the serialization method?
e
you can implement only
DeserializationStrategy<T>
and pass that to
decodeFromString
most APIs are set up assuming both serialize and deserialize though