Skip to content

JsonObject

Create a JSON Object. An object can be created by providing a JS object value which will be serialized to JSON. Else, you can provide children that comprise the object’s JSON representation.

Create a JSON object by providing children that define the object’s contents. The children should use the JsonObjectProperty component to define individual object properties.

import { JsonObject } from "@alloy-js/json";
<JsonObject
refkey={Refkey | Refkey[]}
style={{
concise?: boolean;
}}
>
{children}
</JsonObject>
childrenChildrenThe contents of the JSON object. Likely to contain JsonObjectProperty components.
refkeyoptional Refkey | Refkey[]The refkey or array of refkeys for the JSON object. When provided, this value can be referenced elsewhere via this refkey.
styleoptional { concise?: boolean; }

Create a JSON object by providing a JS value that will be serialized to JSON.

import { JsonObject } from "@alloy-js/json";
<JsonObject
jsValue={[string, unknown][] | Map<string, unknown> | Record<string, unknown>}
refkey={Refkey | Refkey[]}
style={{
concise?: boolean;
}}
/>
jsValue[string, unknown][] | Map<string, unknown> | Record<string, unknown>The JS value to serialize to JSON. This can be an array of key-value pairs, a map, or a vanilla JS object.
refkeyoptional Refkey | Refkey[]The refkey or array of refkeys for the JSON object. When provided, this value can be referenced elsewhere via this refkey.
styleoptional { concise?: boolean; }
  • [unresolved link]