Is there an object dumper method available?


#1

Hi,

Does Kotlin provides any object dumper utility that prints the content and/or its type information for debug/utility purpose? Something like Groovy’s Object.dump() functionality would be very useful.

Zemian


#2

Unfortunately, there is no such utility. If you have data class, it will have automatically generated toString() function containing all its properties. For other classes, you can use toString(), as well (if it has non-trivial implementation).