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
sandwwraith
10/07/2021, 10:37 AM
It's not possible at the moment. You need to specify serializer for each type separately
m
Matthew Cachia
10/07/2021, 10:41 AM
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)