DevOps

Feature Flags JSON Example

A production-ready JSON example for a feature flag configuration object — covering gradual rollouts, A/B test variants, flag dependencies, and environment targeting. Used in LaunchDarkly-style flag systems.

{
  "version": "2",
  "environment": "production",
  "updatedAt": "2025-01-15T08:00:00Z",
  "flags": {
    "newDashboard": {
      "enabled": true,
      "rollout": 100,
      "description": "Redesigned analytics dashboard",
      "createdAt": "2025-01-01"
    },
    "betaCheckout": {
      "enabled": true,
      "rollout": 25,
      "description": "New one-page checkout flow",
      "variants": [
        "control",
        "variant_a",
        "variant_b"
      ],
      "createdAt": "2025-01-10"
    },
    "darkMode": {
      "enabled": true,
      "rollout": 100,
      "description": "Dark mode toggle in user settings",
      "createdAt": "2024-12-01"
    },
    "aiSearchSuggestions": {
      "enabled": false,
      "rollout": 0,
      "description": "AI-powered search autocomplete",
      "requiredFlags": [
        "newDashboard"
      ],
      "createdAt": "2025-01-14"
    }
  }
}

Field Reference

versionstringrequiredSchema version of the flag config format.
environmentstringrequiredTarget environment: production, staging, development.
updatedAtstring (ISO 8601)requiredWhen this config was last modified.
flags.<name>.enabledbooleanrequiredMaster on/off switch for this flag.
flags.<name>.rolloutnumber (0–100)requiredPercentage of users who see the new experience.
flags.<name>.descriptionstringrequiredHuman-readable explanation of what this flag controls.
flags.<name>.variantsstring[]optionalNamed variants for A/B or multivariate tests.
flags.<name>.requiredFlagsstring[]optionalOther flags that must be enabled for this flag to activate.
flags.<name>.createdAtstring (date)optionalISO date when this flag was created.

Variants

Staging environmentAll flags enabled at 100% in staging for full QA coverage
Staging environment
{
  "version": "2",
  "environment": "staging",
  "updatedAt": "2025-01-15T08:00:00Z",
  "flags": {
    "newDashboard": {
      "enabled": true,
      "rollout": 100
    },
    "betaCheckout": {
      "enabled": true,
      "rollout": 100
    },
    "darkMode": {
      "enabled": true,
      "rollout": 100
    },
    "aiSearchSuggestions": {
      "enabled": true,
      "rollout": 100
    }
  }
}

Common Use Cases

  • Gradually rolling out a new UI to 5%, 25%, 50%, then 100% of users
  • Running A/B tests with named variants and tracking conversion by variant
  • Disabling a broken feature in production without deploying new code
  • Gating beta features behind flags for early-access users only
  • Managing per-environment configuration without code changes
feature flagsLaunchDarklyrolloutA/B testingconfigurationDevOps

Validate or format this JSON

Paste the example above into JSONKit's tools to validate, minify, or explore the structure interactively.

Frequently Asked Questions

Environment variables are set at deploy time and require a redeploy to change. Feature flags are dynamic — you change them in a dashboard or config file and they take effect immediately, without a new deployment. This makes flags ideal for gradual rollouts and emergency kills.

Rollout is typically calculated by hashing a stable user identifier (user ID or device ID) modulo 100. This ensures the same user always sees the same variant — not random per-request. A 25% rollout means users whose hash falls in 0–24 see the new experience.

A flag dependency means flag B only activates if flag A is also enabled. This prevents partially-built features from activating in production. For example, aiSearchSuggestions requires newDashboard because the new search UI only exists in the redesigned dashboard.

JSON files work well for small teams and simple on/off flags checked at startup. As you need real-time updates, user targeting, and analytics, move to a dedicated service (LaunchDarkly, Unleash, Flagsmith). Keep the JSON schema the same so migration is a config swap, not a code rewrite.

Related JSON Examples