JsonObjectBuilder

class JsonObjectBuilder(initialFields: Map<String, JsonValue> = emptyMap())

Builder class for constructing JSON objects in a structured and type-safe way.

This class provides methods to add key-value pairs to a JSON object, supporting various types of values such as primitives, nulls, arrays, and nested objects.

Methods in this class follow a builder pattern and return the instance of the builder itself to allow for method chaining. When the configuration is complete, the build method can be called to create an immutable JsonObject.

Usage of this class is typically done within the context of a DSL, enabled by the @ChatDsl annotation.

Constructors

Link copied to clipboard
constructor(initialFields: Map<String, JsonValue> = emptyMap())

Functions

Link copied to clipboard
fun put(key: String, value: Any?): JsonObjectBuilder
Link copied to clipboard
Link copied to clipboard