JSON
A field for arbitrary JSON values.
The JSON field stores an arbitrary JSON value — an object, an array, or any nested shape. Reach for it when the data does not fit the other field types: a third-party API payload, a flexible configuration blob, or a value whose shape you don't control.
defineJsonField({ name: 'metadata', label: 'Metadata' })Treat JSON as an escape hatch. Dyrected does not validate the value against a schema, so nothing guarantees its shape — you own that in your own code. When the structure is known and stable, prefer typed fields instead: a Object for a fixed set of nested fields, or an Array for a repeating one. Those give editors real inputs and give you a checked shape; JSON gives you a raw editor and full flexibility.
Formatting how the value displays
A raw JSON blob is noisy in a list column. Set admin.format to 'summary' to show just a key or item count instead:
defineJsonField({ name: 'metadata', label: 'Metadata', admin: { format: 'summary' } })That renders as { 3 keys } for an object or [ 5 items ] for an array — enough to see a value is present without unpacking it. Use 'code' instead for a short truncated preview of the raw JSON. Either way the full value is untouched and still editable.
Generated reference
The contract below is generated from the public @dyrected/core exports by @dyrected/knowledge, so it stays in sync with the package. See Fields for the shared field options every type accepts.
JsonField
An arbitrary JSON value. Dyrected stores it as-is and does not validate its shape.
export type JsonField = TypedField<
"json",
Record<string, unknown>,
JsonFieldAdmin
>;JsonFieldAdmin
Exported type from @dyrected/core.
export type JsonFieldAdmin = {
/** How the value is displayed in read-only Admin surfaces. Does not affect storage or editing. */
format?: JsonFormat;
};JsonFormat
How a json value is presented in read-only Admin surfaces. Display only.
export type JsonFormat =
/** Shorthand for the matching object form. */
| "summary"
| "code"
/** A compact key count, e.g. `{ 3 keys }`. */
| { type: "summary" }
/** A truncated inline monospace preview of the raw JSON. */
| { type: "code" };