Skip to content

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 by defineCollection)
  • required — false
  • defaultValue — undefined
  • admin.hidden — false
  • admin.readOnly — false
  • admin.position — "main"
  • admin.width — "100%"
  • admin.cellAlignment — "left"

TCollectionSlug extends string = string

TFieldKey extends string = never

TFieldMeta extends BaseFieldMeta = BaseFieldMeta

JsonFieldInput<TCollectionSlug, TFieldKey, TFieldMeta>

Json field configuration. All properties are optional.

JsonField<TCollectionSlug, TFieldMeta>

Resolved json field definition with all defaults applied.

import { json, defineCollection } from '@vexcms/core'
siteSettings: defineCollection({
fields: {
metadata: json({ label: "Raw Metadata" }),
}
})