Kotlin Js(via multi platform) and console.log


import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

data class BlogPostDto (override var id:Long, override var dateCreated: Long, override var dateUpdated: Long): DataTransportObject{
    var title:String = ""
    var description:String = ""
    var content:String = ""
    var secRoleDetailAuthor:DtoMin = DtoMin(0,0,0)

interface DataTransportObject {
var id: Long
var dateCreated: Long
var dateUpdated: Long

When trying to log data classes in my Multi-Platform kotlin react project i see the results just like the screen shot. I am assuming i did something wrong, just not sure what…


Hi, it’s a bit unclear what the problem is. Can you please explain what did you expect to see instead?


Should i be concerned about the generated fields like id_7dug6t???


When you pass an object to console.log it shows it as is at runtime so in your case it works as expected, If you need serialized/JSON version you can write something like console.log(JSON.stringify(yourObject))


The related issue: kotlinx.serialization/issues/116