Kotlin Js(via multi platform) and console.log


#1

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

@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 = ""
    @SerialName("secRoleDetailAuthor")
    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…


#2

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


#3

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


#4

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))


#5

The related issue: kotlinx.serialization/issues/116