json
json<
TCollectionSlug,TFieldKey,TFieldMeta>(options?):JsonField<TCollectionSlug,TFieldMeta>
Defined in: packages/core/src/fields/json/config.ts:43
Creates a json field with all defaults applied.
Json fields store arbitrary JSON-serializable values with no fixed shape —
settings blobs, feature flags, raw API payloads. Shape checks are not part
of this field type; use the field’s own server validate() for that.
Accepts JsonFieldInput (all optional) and returns JsonField with all defaults applied.
Defaults applied:
label—""(inferred from the field key bydefineCollection)required—falsedefaultValue—undefinedadmin.hidden—falseadmin.readOnly—falseadmin.position—"main"admin.width—"100%"admin.cellAlignment—"left"
Type Parameters
Section titled “Type Parameters”TCollectionSlug
Section titled “TCollectionSlug”TCollectionSlug extends string = string
TFieldKey
Section titled “TFieldKey”TFieldKey extends string = never
TFieldMeta
Section titled “TFieldMeta”TFieldMeta extends BaseFieldMeta = BaseFieldMeta
Parameters
Section titled “Parameters”options?
Section titled “options?”JsonFieldInput<TCollectionSlug, TFieldKey, TFieldMeta>
Json field configuration. All properties are optional.
Returns
Section titled “Returns”JsonField<TCollectionSlug, TFieldMeta>
Resolved json field definition with all defaults applied.
Example
Section titled “Example”import { json, defineCollection } from '@vexcms/core'
siteSettings: defineCollection({ fields: { metadata: json({ label: "Raw Metadata" }), }})- JsonFieldInput for the full input type
- JsonField for the resolved output type