> ## Documentation Index
> Fetch the complete documentation index at: https://docs2.growthbook.io/llms.txt
> Use this file to discover all available pages before exploring further.

# JSON Schema Validation

> Validate JSON, string, and number feature flag values against a schema to prevent typos and costly mistakes.

export const CommercialFeature = ({feature, description}) => {
  const commercialFeatures = {
    "adv-presentations": {
      plan: "enterprise",
      displayName: "Adv Presentations"
    },
    "advanced-permissions": {
      plan: "pro",
      displayName: "Advanced Permissions"
    },
    "ai-byok": {
      plan: "enterprise",
      displayName: "Ai Byok"
    },
    "ai-suggestions": {
      plan: "enterprise",
      displayName: "AI Suggestions"
    },
    archetypes: {
      plan: "pro",
      displayName: "Archetypes"
    },
    "audit-logging": {
      plan: "enterprise",
      displayName: "Audit Logging"
    },
    "cloud-proxy": {
      plan: "pro",
      displayName: "Cloud Proxy"
    },
    "code-references": {
      plan: "pro",
      displayName: "Code References"
    },
    "contextual-bandits": {
      plan: "enterprise",
      displayName: "Contextual Bandits"
    },
    "custom-hooks": {
      plan: "enterprise",
      displayName: "Custom Hooks"
    },
    "custom-launch-checklist": {
      plan: "enterprise",
      displayName: "Custom Launch Checklist"
    },
    "custom-markdown": {
      plan: "enterprise",
      displayName: "Custom Markdown"
    },
    "custom-metadata": {
      plan: "enterprise",
      displayName: "Custom Metadata"
    },
    "custom-roles": {
      plan: "enterprise",
      displayName: "Custom Roles"
    },
    dashboards: {
      plan: "enterprise",
      displayName: "Dashboards"
    },
    "decision-framework": {
      plan: "pro",
      displayName: "Decision Framework"
    },
    "encrypt-features-endpoint": {
      plan: "pro",
      displayName: "Encrypt Features Endpoint"
    },
    "environment-inheritance": {
      plan: "enterprise",
      displayName: "Environment Inheritance"
    },
    "events-forwarder": {
      plan: "pro",
      displayName: "Events Forwarder"
    },
    "experiment-impact": {
      plan: "enterprise",
      displayName: "Experiment Impact"
    },
    "feature-configs": {
      plan: "enterprise",
      displayName: "Feature Configs"
    },
    "funnel-metrics": {
      plan: "pro",
      displayName: "Funnel Metrics"
    },
    "hash-secure-attributes": {
      plan: "pro",
      displayName: "Hash Secure Attributes"
    },
    "historical-power": {
      plan: "pro",
      displayName: "Historical Power"
    },
    holdouts: {
      plan: "enterprise",
      displayName: "Holdouts"
    },
    "incremental-refresh": {
      plan: "enterprise",
      displayName: "Incremental Refresh"
    },
    "json-validation": {
      plan: "enterprise",
      displayName: "JSON Validation"
    },
    "large-saved-groups": {
      plan: "enterprise",
      displayName: "Large Saved Groups"
    },
    learnings: {
      plan: "enterprise",
      displayName: "Learnings"
    },
    livechat: {
      plan: "pro",
      displayName: "Livechat"
    },
    "manage-official-resources": {
      plan: "enterprise",
      displayName: "Manage Official Resources"
    },
    "metric-correlations": {
      plan: "enterprise",
      displayName: "Metric Correlations"
    },
    "metric-effects": {
      plan: "enterprise",
      displayName: "Metric Effects"
    },
    "metric-groups": {
      plan: "enterprise",
      displayName: "Metric Groups"
    },
    "metric-populations": {
      plan: "pro",
      displayName: "Metric Populations"
    },
    "metric-slices": {
      plan: "enterprise",
      displayName: "Metric Slices"
    },
    "multi-armed-bandits": {
      plan: "pro",
      displayName: "Multi Armed Bandits"
    },
    "multi-metric-queries": {
      plan: "enterprise",
      displayName: "Multi Metric Queries"
    },
    "multi-org": {
      plan: "enterprise",
      displayName: "Multi Org"
    },
    "multiple-sdk-webhooks": {
      plan: "pro",
      displayName: "Multiple Sdk Webhooks"
    },
    "no-access-role": {
      plan: "enterprise",
      displayName: "No Access Role"
    },
    "override-metrics": {
      plan: "pro",
      displayName: "Override Metrics"
    },
    "pipeline-mode": {
      plan: "enterprise",
      displayName: "Pipeline Mode"
    },
    "post-stratification": {
      plan: "enterprise",
      displayName: "Post Stratification"
    },
    "precomputed-dimensions": {
      plan: "pro",
      displayName: "Precomputed Dimensions"
    },
    "prerequisite-targeting": {
      plan: "enterprise",
      displayName: "Prerequisite Targeting"
    },
    prerequisites: {
      plan: "pro",
      displayName: "Prerequisites"
    },
    "product-analytics-dashboards": {
      plan: "pro",
      displayName: "Product Analytics Dashboards"
    },
    "project-admin-role": {
      plan: "enterprise",
      displayName: "Project Admin Role"
    },
    "quantile-metrics": {
      plan: "pro",
      displayName: "Quantile Metrics"
    },
    "ramp-schedules": {
      plan: "pro",
      displayName: "Ramp Schedules"
    },
    redirects: {
      plan: "pro",
      displayName: "Redirects"
    },
    "regression-adjustment": {
      plan: "pro",
      displayName: "CUPED"
    },
    releases: {
      plan: "enterprise",
      displayName: "Releases"
    },
    "remote-evaluation": {
      plan: "pro",
      displayName: "Remote Evaluation"
    },
    "require-approvals": {
      plan: "enterprise",
      displayName: "Require Approvals"
    },
    "require-project-for-features-setting": {
      plan: "enterprise",
      displayName: "Require Project For Features Setting"
    },
    "require-project-for-sdk-connections-setting": {
      plan: "enterprise",
      displayName: "Require Project For Sdk Connections Setting"
    },
    "retention-metrics": {
      plan: "pro",
      displayName: "Retention Metrics"
    },
    "safe-rollout": {
      plan: "pro",
      displayName: "Safe Rollout"
    },
    saveSqlExplorerQueries: {
      plan: "pro",
      displayName: "Save SQL Explorer Queries"
    },
    "schedule-feature-flag": {
      plan: "pro",
      displayName: "Schedule Feature Flag"
    },
    "scheduled-revisions": {
      plan: "enterprise",
      displayName: "Scheduled Revisions"
    },
    scim: {
      plan: "enterprise",
      displayName: "SCIM"
    },
    "sequential-testing": {
      plan: "pro",
      displayName: "Sequential Testing"
    },
    "share-product-analytics-dashboards": {
      plan: "enterprise",
      displayName: "Share Product Analytics Dashboards"
    },
    simulate: {
      plan: "pro",
      displayName: "Simulate"
    },
    sso: {
      plan: "enterprise",
      displayName: "SSO"
    },
    "sticky-bucketing": {
      plan: "pro",
      displayName: "Sticky Bucketing"
    },
    teams: {
      plan: "enterprise",
      displayName: "Teams"
    },
    templates: {
      plan: "enterprise",
      displayName: "Templates"
    },
    "unlimited-managed-warehouse-usage": {
      plan: "pro",
      displayName: "Unlimited Managed Warehouse Usage"
    },
    "visual-editor": {
      plan: "pro",
      displayName: "Visual Editor"
    }
  };
  const {plan, displayName} = commercialFeatures[feature];
  const isEnterprise = plan === "enterprise";
  const defaultDescription = isEnterprise ? "is available on Enterprise plans." : "is available on Pro and Enterprise plans.";
  const planLabel = isEnterprise ? "Enterprise" : "Pro";
  const containerStyle = isEnterprise ? {
    backgroundColor: "color-mix(in srgb, var(--indigo-a3) 60%, transparent)"
  } : {
    backgroundColor: "color-mix(in srgb, var(--amber-a3) 60%, transparent)"
  };
  const badgeStyle = isEnterprise ? {
    boxShadow: "inset 0 0 0 1px var(--indigo-a8)",
    color: "var(--indigo-a11)"
  } : {
    boxShadow: "inset 0 0 0 1px var(--amber-a8)",
    color: "var(--amber-a11)"
  };
  return <div className="flex items-start gap-2 mb-4 p-3 text-sm leading-[1.4] rounded-lg" style={containerStyle} role="note">
      <span className="inline-flex items-center justify-center px-1.5 h-5 text-xs font-medium rounded-full shrink-0 leading-none" style={badgeStyle}>
        {planLabel}
      </span>
      <div className="flex-1 leading-[1.3]">
        <strong className="font-semibold">{displayName}</strong>{" "}
        {defaultDescription} {description}
      </div>
    </div>;
};

<CommercialFeature feature="json-validation" />

JSON feature flags are powerful, especially for remote configuration, letting you ship structured data like pricing rules, layout settings, or experiment parameters without a code deploy. That flexibility comes with a risk: a single typo or missing field in a JSON blob can break production. GrowthBook Enterprise lets you attach a schema to a flag so every value is validated against the structure you define.

Validation isn't limited to JSON flags. You can also add a schema to **string** and **number** flags — for example, to restrict a string flag to a set of allowed values or keep a number flag within a min/max range. (Boolean flags can't have a schema.)

<Frame>
  <img src="https://mintcdn.com/growthbook-ea15456d/1rsmujQCDzXz2Vho/static/images/features/json-schema/validation-banner.png?fit=max&auto=format&n=1rsmujQCDzXz2Vho&q=85&s=21f477dba1a2c3adf099586dbeabb641" alt="JSON Schema Validation" width="800" data-path="static/images/features/json-schema/validation-banner.png" />
</Frame>

## Why Validate?

When you're using GrowthBook for remote evaluation, your JSON feature flag values are consumed directly by your application. There's no compiler or type checker between the flag editor and your users. A missing key, a misspelled property, or the wrong type can cause broken UIs, crashed clients, or silent misbehavior.

Adding a schema means:

* Invalid values can't be saved and mistakes are caught before publishing.
* Editors see the exact shape of the data they need to provide.
* Consumers of the flag can trust the structure.

## Enabling Validation

Open a JSON, string, or number feature flag, go to its **Validation** tab, and find the **Schema Validation** section. Click **Enable** to open the schema editor. You can switch validation on or off at any time, and edit the schema later from the same section.

<Frame>
  <img src="https://mintcdn.com/growthbook-ea15456d/1rsmujQCDzXz2Vho/static/images/features/json-schema/validation-form.png?fit=max&auto=format&n=1rsmujQCDzXz2Vho&q=85&s=06ec1b51873754a4d611035c604504ee" alt="JSON Schema Editor" width="800" data-path="static/images/features/json-schema/validation-form.png" />
</Frame>

## Two Ways to Define a Schema

GrowthBook supports two modes for defining your schema.

### Simple Schema Builder

For most configuration flags, a full JSON Schema is more than you need. The Simple Schema Builder is a UI-driven editor for common object shapes, so you don't have to write any schema by hand.

Choose a root type:

* **Object** - a fixed set of named properties
* **Array of Objects** - a list of objects, all matching the same shape
* **Primitive Value** - a single string, number, or boolean
* **Array of Primitive Values** - a list of primitives

(For **string** and **number** flags the value is always a single primitive, so the builder skips this choice and goes straight to configuring that value.)

For each property you add, you can configure:

* **Property Key** and **Description**
* **Type** - Text String, Integer, Float, or Boolean
* **Required** (for object properties)
* **Restrict to Specific Values** - limit the property to an enum of allowed values
* **Min / Max** - bound the length of a string or the range of a number

### Raw JSON Schema

When you need more expressiveness than the Simple Builder offers - nested objects, conditional schemas, regex patterns, references, and so on - switch to raw JSON Schema mode and paste in a full [JSON Schema](https://json-schema.org/) document. Anything a standard JSON Schema validator accepts will work here.

For string and number flags, the schema's top-level `type` must match the flag — `string` for string flags, `number` or `integer` for number flags.

## The Editing Experience

When validation is enabled with a Simple Schema, GrowthBook replaces the raw JSON textarea with a generated form. Instead of editing a JSON blob, editors get a dedicated input for each property:

* **Objects** render as a form with one field per property.
* **Arrays of objects** render as a table - add and remove rows with buttons.
* **Primitives** render as the appropriate input type (text, number, checkbox).
* **Enums** render as a dropdown or multi-select with the allowed values.

<Frame>
  <img src="https://mintcdn.com/growthbook-ea15456d/1rsmujQCDzXz2Vho/static/images/features/json-schema/value-editor.png?fit=max&auto=format&n=1rsmujQCDzXz2Vho&q=85&s=da409a3a015b517b7cfc8596f94a1d27" alt="Simplified editing UI for simple schemas" width="800" data-path="static/images/features/json-schema/value-editor.png" />
</Frame>

This form-based editor appears everywhere you set the flag's value: the default value, forced-value rules, rollout rules, and experiment variations. If you ever want to bypass the form, click **Edit as JSON** to switch back to the raw editor.

For raw JSON Schemas that are too complex for the form view, editors continue to use the JSON editor, but values are still validated against the schema on save.

## Validation Errors

When you try to save a value that doesn't match the schema, GrowthBook shows an inline error with the specific reasons it failed - which property is missing, which value is out of range, which field has the wrong type. Fix the issues and save again. Invalid values can't be published.

## Related

* [Feature Flag Basics](/features/basics) — overview of the JSON flag type
* [Configs](/features/configs) — reuse one typed, validated schema (and value) across many JSON flags instead of defining a schema per flag (Enterprise)
* [Custom Hooks](/features/custom-hooks) — when you need more validation control than a schema provides, run custom server-side validation logic (self-hosted Enterprise)
* [Publishing & Approval Flows](/features/publishing-and-approval-flows) — combine schema validation with required approvals for an extra layer of safety
