I would like to apply a JsonTransformingSerializer...
# serialization
m
I would like to apply a JsonTransformingSerializer to all kinds (Any?). I read through the guide but I still can't seem to connect he docs on how I can apply it. Is it something I should add in a serializermodule? Much appreciated
s
It's not possible at the moment. You need to specify serializer for each type separately
m
Thanks @sandwwraith. I just discovered a workaround:
Copy code
object JsonEleTransformer = ...

val jsonEle = json.parseToJsonElement("{...}")
val transformedJsonEle = json.decodeFromJsonElement(JsonEleTransformer, jsonEle)

val t:T = json.decodeFromJsonElement(transformedJsonEle)
It works. Thank you just the same.
s
Good idea!