toMap

fun <T : Any> toMap(obj: T): Map<String, Any?>

Can be used to convert an object of a data class to a map. https://www.baeldung.com/kotlin/data-class-to-map