Skip to content

JsonArray

Create a JSON Array. You can provide children, or else pass a JS value that will be serialized to JSON.

Overload 1

Create a JSON Array by serializing the given JavaScript array to JSON.

import { JsonArray } from "@alloy-js/json";
<JsonArray jsValue={unknown[]} refkey={Refkey | Refkey[]} />

Props

jsValueunknown[]

The value to serialize to a JSON array.

refkeyoptionalRefkey | Refkey[]

The refkey or array of refkeys for the JSON array. When provided, this value can be referenced elsewhere via this refkey.

Overload 2

Create a JSON Array by providing the children. To create an array element, see JsonArrayElement.

import { JsonArray } from "@alloy-js/json";
<JsonArray refkey={Refkey | Refkey[]}>
{children}
</JsonArray>

Props

childrenoptionalChildren

The contents of the JSON Array. Likely to contain JsonArrayElement components.

refkeyoptionalRefkey | Refkey[]

The refkey or array of refkeys for the JSON array. When provided, this value can be referenced elsewhere via this refkey.

See also