is it currently possible to write a .main.kts that...
# scripting
n
is it currently possible to write a .main.kts that defines and uses
@Serializable
classes? how would is enable to kotlinx-serialization plugin ? i want to write a script to do a bit of json processing
j
you can't apply the Gradle plugin so it can't codegen the needed things so you should use moshi or gson
m
There's a '-XPlugin' option iirc
But most of the time, I just use the kotlinx.serialization runtime and parse everything dynamically
n
i tried those tricks but i cannot use
Foo.serializer()
or such
m
You can use something like
Json.decodeFromString(str)
And it gives you a
JsonElement
or so
Don't take this as gospel, I'm on mobile right now but it's definitely doable without any gradle or compiler plugin