I'm calling `encodeToString` with an object of typ...
# serialization
p
I'm calling
encodeToString
with an object of type
Map<String, Boolean>
. I now pass
Copy code
MapSerializer(String.serializer(), Boolean.serializer())
as the first argument to make it work, but I'm fairly sure there's a way for the compiler to infer it. Is there (without creating a wrapper type annotated with
@Serializable
)? 🙂
k
There's the
encodeToString
which takes a reified type parameter and then uses reflection to look up the type's serializers. This comes at a performance penalty though.
p
thanks!
e
there's no penalty anymore as it is now intrinsified, https://github.com/Kotlin/kotlinx.serialization/issues/1348
🎉 2
k
Neat! I had no idea.