This simple code doesn't work with IR backend at a...
# javascript
r
This simple code doesn't work with IR backend at all:
Copy code
@JsExport
data class Test(val content: String)

val json = "{\"content\":\"data\"}"
val test = kotlin.js.JSON.parse<Test>(json)
println(test.content)
Property is
undefined
, no matter if I use
@JsExport
or not. It works fine with legacy and the only workaround for IR seems to be
parse<dynamic>()
. Is this a known issue? Can't find anything on YT.
Or perhaps should I just assume we can't use native
JSON
with Kotlin types anymore, since the returned object always just pretended to be a Kotlin data class?
Nevertheless it was very useful ... 🙂