Is there a simple way to generate converters to/fr...
# javascript
a
Is there a simple way to generate converters to/from `data class`es and Kotlin/JS's
Json
interface? https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.js/-json/index.html Is this something that
kotlinx.serialization
supports? I'm trying to create a wrapper around my Kotlin library so that I can pass in JS objects (i.e.,
{foo: "bar"}
and then convert the resulting
Json
object into an instance of
data class MyDataClass(val foo: String)
, and vice versa when returning an instance of
MyDataClass
from Kotlin to JS
a
If I’m reading it correctly, it looks like thats using JSON as a serialization format for converting to/from Strings. I’m looking for a way to convert to/from objects of Kotlin/JS’s kotlin.js.Json type: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.js/-json/index.html Is there a way to do this? Am I just reading the example incorrectly?