to

infix fun String.to(value: Any?)

Set a nested property.


infix fun String.to(blocks: List<JsonObjectBuilder.() -> Unit>)

Set an array property with a list of object builders. This allows creating arrays of objects using DSL syntax.

Example:

"grades" to listOf(
{ "courseCode" to "CS101"; "grade" to "A" },
{ "courseCode" to "MATH101"; "grade" to "B" }
)