encodeToString

fun <T> encodeToString(serializer: SerializationStrategy<T>, value: T): String

Encodes value to a JSON string using the given serializer explicitly (rather than one resolved from T's reified type) — the general escape hatch for a caller that already has its own SerializationStrategy.


inline fun <T> encodeToString(value: T): String

Encodes value to a JSON string, resolving T's serializer from this serializer's own serializersModule via reification — the convenient overload for a caller that has a compile-time type to encode, rather than an explicit SerializationStrategy.