# A form for a JSON field – Schema Builder

Contentful's JSON object field shows editors raw JSON. How to give them a validated form instead.

Contentful's **JSON object** field stores any JSON, but editors see it as raw code. One missing comma and the entry won't save, and nothing stops a key from being misspelled or a number being typed as text. This page compares the ways to give editors a proper form instead, and shows where Schema Builder fits.

## At a glance

| Approach                                 | What editors see                    | Checks the shape of the data?      | Effort                                     |
| ---------------------------------------- | ----------------------------------- | ---------------------------------- | ------------------------------------------ |
| Keep the JSON object field as it is      | A code editor with raw JSON         | No, only that it's valid JSON      | None, but editors need to know JSON        |
| Replace it with regular Contentful fields | Contentful's own form              | Yes, with field validations        | A content model change, and more fields    |
| A custom field app for that one field    | A form you design                   | Yes, as far as you build it        | An app to build and maintain               |
| A Schema Builder schema                  | A form generated from the schema    | Yes, as editors type               | Define the schema in the app's editor      |

## Replace the JSON with regular fields

If the website needs Contentful to filter or sort by the values, regular fields are the right answer: Contentful can query them, and editors get its standard form. The cost is a content model change, and every new shape means more fields or another content type.

## A custom field app

Contentful apps can replace the editor of a single field. A custom app can show any form you like and write JSON back to the field. That suits one important field with an unusual shape, but each shape is code someone has to build, test and keep up to date.

## Schema Builder

Schema Builder gives editors a form for JSON without writing code. An admin defines a **schema** (fields, types, sections, repeaters and validation) in the app's schema editor. Editors pick the schema on a **Schema Builder Entry** and fill in a generated form. The values are saved as clean JSON in the entry's `jsonField`, checked against the schema on every change.

- **Validation as editors type.** Each schema becomes a JSON Schema. Required fields, lengths, formats, ranges and patterns are checked in the form, and invalid entries are flagged to Contentful.
- **Types for developers.** **Developer exports** gives TypeScript types and a JSON Schema for each schema. See [Types and validation](https://contentful.geeconglobal.com/apps/schema-builder/docs/types-and-validation).
- **One content type.** Every schema shares the Schema Builder content type, so new shapes don't add content types.

> **Things to know**
>
>
> - Schema Builder edits the JSON field of its own content type. It doesn't replace the editor of JSON fields in your other content types. To use it there, link a Schema Builder entry from that content type with a Reference field.
> - Contentful can't filter or sort by values inside JSON, whichever editor you use. See [When to use it](https://contentful.geeconglobal.com/apps/schema-builder/docs/when-to-use).
>

## Which to choose

- The website queries by these values: use regular fields.
- One field, one unusual shape and a developer to maintain it: a custom field app.
- Several JSON shapes that admins should be able to define and change: Schema Builder.

Start with [Getting started](https://contentful.geeconglobal.com/apps/schema-builder/docs/getting-started), or see [Data format](https://contentful.geeconglobal.com/apps/schema-builder/docs/data-format) for exactly what's stored.
