The problem is that you try to call a function expecting an
java.lang.Object. When you use java this is no problem as Object is the superclass of any other class in java so you can just pass any object and java will cast it for you. Kotlin on the other hand does not automatically cast an object to
java.lang.Object. This is the reason why you get the error.
I would suggest you add an extension method to Gson like this
fun Gson.toJson(src: Any) : String = toJson(src as java.lang.Object)
Also there is a Kotlin library for serialization. But I think it is still in development. Just thought I point that out.