Skip to main content

Ignoring Properties

Just like in Kotlinx.Serialization, fields can be ignored

A property can be excluded from serialization by marking it with the @Transient annotation (don't confuse it with kotlin.jvm.Transient). Transient properties must have a default value.

import kotlinx.serialization.Transient

@Serializable
class SimpleTypes(
@Transient
val aString: String = "default-value"
)

fun main() {
val tsGenerator = KxsTsGenerator()
println(tsGenerator.generate(SimpleTypes.serializer()))
}

You can get the full code here.

export interface SimpleTypes {
}