I would like to write an function, that would work on any object which is serializable. Something like this:
inline fun <reified @Serializable T> T.serialiseToJson(): String {
return format.encodeToString(this)
}
This doesnt work because you cant use @Serializable to annotate type parameter.
Is there a way to do this?