Is there any easy way or any standard library method to convert a Kotlin data class object to a map/dictionary of it\'s properties by property names? Can reflection be avoid
This extension function uses reflection, but maybe it'll help someone like me coming across this in the future:
inline fun T.asMap() : Map { val props = T::class.memberProperties.associateBy { it.name } return props.keys.associateWith { props[it]?.get(this) } }