xref: /aosp_15_r20/external/kotlinx.serialization/guide/example/example-json-17.kt (revision 57b5a4a64c534cf7f27ac9427ceab07f3d8ed3d8)
1 // This file was automatically generated from json.md by Knit tool. Do not edit.
2 package example.exampleJson17
3 
4 import kotlinx.serialization.*
5 import kotlinx.serialization.json.*
6 
mainnull7 fun main() {
8     val element = buildJsonObject {
9         put("name", "kotlinx.serialization")
10         putJsonObject("owner") {
11             put("name", "kotlin")
12         }
13         putJsonArray("forks") {
14             addJsonObject {
15                 put("votes", 42)
16             }
17             addJsonObject {
18                 put("votes", 9000)
19             }
20         }
21     }
22     println(element)
23 }
24