Will this work: `inline fun <reified T: Payment...
# klaxon
d
Will this work:
inline fun <reified T: PaymentResponse> T.toJson() = ServerResponse.Json(this)
Given:
Copy code
sealed class ServerResponse {
	data class Error(val statusCode: Int, val message: String) : ServerResponse()

	data class Json(val jsonObj: Any) : ServerResponse() {
		val jsonString: String
			get() = Klaxon().toJsonString(jsonObj)
	}
}
Or do I have to worry about type erasure @cedric?