i have a annoying api where a timestamp can be a s...
# serialization
n
i have a annoying api where a timestamp can be a string or a long, is there a way to tell in the deserializer what JSON type a field is ? number literal or string literal or is ther tryParseLong() or similar ?
s
You can create custom serializer for that type and in
deserialize()
cast deserializer to JSONReader to read your value as raw json element: https://github.com/kotlin/kotlinx.serialization/blob/eap13/runtime/jvm/src/test/kotlin/kotlinx/serialization/formats/json/JsonTreeAndMapperTest.kt#L40