Hi! I’m trying to use kotlin.serialiazation in a g...
# gradle
o
Hi! I’m trying to use kotlin.serialiazation in a gradle task in order to read a json file, modify it and save the file again. Open for other suggestions 🙂. It was working with groovy using JsonSluper. Is that possible? Existing and working code in Groovy.
Copy code
def file = new File(path)
def data = new JsonSlurper().parse(file)
data.types = "my new value"
def json = JsonOutput.prettyPrint(JsonOutput.toJson(data))
👌 2
@Chrimaeon How? 🙂 In my build.gradle.kts I’m trying to import
Copy code
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import kotlinx.serialization.*
import kotlinx.serialization.json.*
But the compiler complains
Unresolved reference: serialization
c
You have to add Kotlin.serialization plug-in to the classpath of the buildscript first
❤️ 1
o
DOH!!…. @Chrimaeon THANKS 🙂