I have the following script: ```import kotlinx.ser...
# scripting
a
I have the following script:
Copy code
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonConfiguration

@Serializable
data class User(
    val name: String
)

val user = User("jon")

val json = Json(JsonConfiguration.Stable)

val jsonData = json.stringify(User.serializer(), user)

val result = json.parse(User.serializer(), jsonData)

require(user == result)
which I try to run in a script but I get the following error:
Copy code
ERROR Unresolved reference: serializer
I guess the problem is that this works with `kotlinx.serialization`'s annotation processing feature. Is it possible to get this working in a script? This is how I run it:
Copy code
private fun evalFile(scriptFile: File): ResultWithDiagnostics<EvaluationResult> {
    val compilationConfiguration = createJvmCompilationConfigurationFromTemplate<TestScript> {
        jvm {
            dependenciesFromCurrentContext(wholeClasspath = true)
        }
    }
    val evalConfig = createJvmEvaluationConfigurationFromTemplate<TestScript> {
        jvm {
            this.mainArguments.put(arrayOf("1"))
        }
    }

    return BasicJvmScriptingHost().eval(scriptFile.toScriptSource(), compilationConfiguration, evalConfig)
}
i
I think you're out of luck at the moment. There is no way to load the serialization plugin to the script compiler. This will be solved at some point in the future, but now it is unfortunately not supported.
a
Thanks. I'll solve this in another way then.