I've got a use case where kotlinx serialization mi...
# javascript
b
I've got a use case where kotlinx serialization might help, but that library only produces kotlin classes which I can't pass as plain JS objects to APIs; is there a solution?
j
You could file a feature request to have the plugin work with `@JsPlainObject`s https://github.com/JetBrains/kotlin/tree/master/plugins/js-plain-objects
b
not 100% if that's a good route to go with since external interfaces are extremely limited in what they support
it would be very helpful already if I could convert a data class into a JS object literal
j
seems like you could write a function to do that conversion pretty easily
b
I'm not sure how well reflection works in this regard
would need to write that for each class
t
Or generate :)
b
not super interested in writing a compiler plugin, I'm already constantly yak shaving 🙂
t
Serialization in "dynamic object" will create JSO
j
Yeah we use serialization to go to dynamic object and then use JSON to actually encode because it's massively faster
âž• 1
a
Maybe this would help @Bernhard? https://github.com/adamko-dev/kotlinx-serialization-typescript-generator It produces TypeScript, but it could be modified to produce JS instead?
b
thank you