blob: 7edd231cc00640ae5fae4bd88a7f80e366c9ac42 [file] [log] [blame]
Roman Elizarov5459c102020-08-11 12:27:36 +03001// This file was automatically generated from polymorphism.md by Knit tool. Do not edit.
2package example.examplePoly07
3
4import kotlinx.serialization.*
5import kotlinx.serialization.json.*
6
7@Serializable
Roman Elizarov2f4d91c2021-05-17 18:53:04 +03008sealed class Project {
9 abstract val name: String
10 var status = "open"
11}
12
Roman Elizarov5459c102020-08-11 12:27:36 +030013@Serializable
Roman Elizarov2f4d91c2021-05-17 18:53:04 +030014@SerialName("owned")
15class OwnedProject(override val name: String, val owner: String) : Project()
Roman Elizarov5459c102020-08-11 12:27:36 +030016
17fun main() {
Roman Elizarov2f4d91c2021-05-17 18:53:04 +030018 val json = Json { encodeDefaults = true } // "status" will be skipped otherwise
19 val data: Project = OwnedProject("kotlinx.coroutines", "kotlin")
20 println(json.encodeToString(data))
Roman Elizarov5459c102020-08-11 12:27:36 +030021}