jsonArray

fun jsonArray(initialValues: List<JsonValue> = emptyList(), builder: JsonArrayBuilder.() -> Unit): JsonArray

Creates a JsonArray using the given initial values and builder lambda.

This function constructs a JsonArray by initializing it with the provided list of JsonValue objects (if any) and then applying the given DSL builder to further configure its contents.

The builder is executed within the context of a JsonArrayBuilder, which provides methods to add various types of elements to the array.

Return

a JsonArray instance containing the elements defined by the initial values and the builder.

Parameters

initialValues

an optional list of initial JsonValue objects to populate the array. Defaults to an empty list.

builder

a DSL builder lambda used to configure the contents of the JSON array.