to
Add a property using infix to syntax.
Example:
"name" to "John Doe"
"age" to 30
"active" to trueContent copied to clipboard
Add a number property.
Add a boolean property.
Add a JsonElement property (for nested objects, arrays, etc.).
Add a nested object using 'to' syntax with DSL-style builder.
Example:
"degree" to {
"type" to "BachelorDegree"
"name" to "Bachelor of Science"
}Content copied to clipboard
Inside the block, use "key" to value syntax (DSL-style).
Add an array of primitives or mixed types.
Example:
"skills" to listOf("Kotlin", "Java", "Python")
"numbers" to listOf(1, 2, 3)Content copied to clipboard
Add an array of objects using DSL syntax.
Example:
"grades" to arrayOfObjects(
{ "courseCode" to "CS101"; "grade" to "A" },
{ "courseCode" to "MATH101"; "grade" to "B" }
)Content copied to clipboard