Flag types
Understand boolean, string, number, and JSON flags and when to choose each.
Overview
This topic explains the four flag types and when to use each one.
When you create a flag, pick a type whose variation values match the data type your application code expects to read and render.
The available types are Boolean, String, Number, and JSON.
Choosing the correct type up front reduces runtime casting, prevents accidental shape drift, and keeps targeting and experimentation readable.
Variation type selector

Boolean flags
Boolean flags are the most common and simplest type. They have two variations: true and false.
Use boolean flags for release gates, kill switches, and any binary enable/disable behavior.
You can rename boolean variation labels for UI clarity, but the underlying values remain true and false.
Boolean flags always have exactly two variations.
String flags
String flags are multivariate and can hold more than two variations.
Use string variations for copy, labels, URLs, identifiers, experience names, or routing decisions.
String values are UTF-8 data. If your app depends on strict byte budgets, account for multibyte characters when planning payload size.
String flags are especially useful when migrating from hard-coded constants to remotely managed values.
Number flags
Number flags hold integer or floating-point values and are multivariate.
Use number variations for thresholds, limits, durations, scoring cutoffs, and configuration coefficients.
When evaluating number flags, keep expected numeric precision and downstream SDK parsing behavior in mind across platforms.
If your rollout logic is sensitive to exact numeric ranges, validate those ranges in staging before broad exposure.
JSON flags
JSON flags hold structured data as objects or arrays and are multivariate.
Use JSON when you need to bundle related settings in one variation, such as UI modules, checkout configuration, or API behavior toggles.
Optional JSON properties may be omitted by design. Application code should safely handle absent properties.
For stability, treat JSON flag shapes as versioned contracts and evolve them intentionally over time.
JSON variation editor

Flag types and SDKs
SDK reads return the variation value currently served for the active user context.
Always pass a meaningful fallback in code. It is used when SDK state is not ready or the key is missing.
In React and React Native, useFlag(flagKey, fallback) and Flags.getFlag(flagKey, fallback) read from the same runtime state.