JSON true/false: How Boolean Values Work and What Changes When You Transform Them
How JSON represents true and false, how they differ from strings, numbers and null, and what formatting, validation or conversion actually changes.
Short answer
JSON has exactly two Boolean values: the bare lowercase literals true and false. They are written without quotes. Anything else that looks like a Boolean, such as "true" in quotes, True, TRUE, yes, no, 1 or 0, is either a different data type or invalid JSON. Formatting and validation tools leave these literals untouched. Tools that convert strings or numbers into Booleans change the data itself. Use them only when you control how the receiving program interprets the values.
What a JSON Boolean is
The JSON standard, RFC 8259, defines true, false and null as literal names. They must be lowercase. A Boolean answers a yes-or-no question in the data, such as whether a feature is enabled or an account is verified. It is one of the core JSON value types, alongside strings, numbers, null, objects and arrays.
{
"active": true,
"archived": false
}
In this example both values are Booleans. A parser in any mainstream language reads them as its native true and false values. JavaScript's JSON.parse produces the primitives true and false. Python's json module produces True and False, and writes them back out as lowercase true and false.
How true and false differ from look-alike values
| Written in JSON | Valid JSON? | What a parser sees |
| true | Yes | Boolean true |
| false | Yes | Boolean false |
| "true" | Yes | A four-character string, not a Boolean |
| "false" | Yes | A five-character string, not a Boolean |
| True or TRUE | No | Syntax error, because literals are case-sensitive |
| 1 or 0 | Yes | A number, not a Boolean |
| null | Yes | Absence of a value, distinct from false |
| yes or no (unquoted) | No | Syntax error, because JSON has no such literals |
The quoted-string case causes the most bugs. In many languages a non-empty string counts as truthy. That means "false" can behave like true in a condition. In Python, bool("false") evaluates to True. In JavaScript, if ("false") runs the branch. Code that receives "false" as a string and tests it directly can therefore do the opposite of what the data intended.
Readers coming from YAML should note one more difference. Some YAML parsers, particularly those following YAML 1.1, treat unquoted yes, no, on and off as Booleans. JSON does not. Only true and false qualify.
What each transformation actually changes
Developer text utilities that handle JSON fall into a few groups. They differ in whether they change the stored data or only its presentation.
- Pretty-printing or formatting: adds or removes whitespace and line breaks. The true and false tokens and every other value stay the same. This is a presentation change only.
- Minifying: removes insignificant whitespace. Again, the values are unchanged.
- Validation: checks syntax and reports errors such as True, TRUE or a trailing comma. It changes nothing unless the tool also offers an auto-fix.
- Schema validation: checks that a field declared with "type": "boolean" actually holds true or false. A string "true" fails this check.
- Type conversion or coercion: rewrites values, for example "true" to true, or 1 to true. This changes the stored data and its type.
Before conversion:
{"enabled": "true", "retries": 1}
After converting string Booleans only:
{"enabled": true, "retries": 1}
In this example only the quoted "true" became a Boolean. The number 1 was left alone, which is the safer behavior. A converter that also turns 1 into true would corrupt a field like retries, where 1 is a count, not a flag. Before trusting any converter, check which inputs it treats as Booleans. The supplied material does not document the behavior of any specific tool, so this has to be confirmed in each tool's own documentation or with a small test file.
Is the transformation suitable for your use?
Formatting, minifying and validation are suitable for almost any use because they preserve meaning. Their main benefit is catching invalid literals such as True or TRUE before a parser rejects the whole document.
Type conversion is suitable only in a narrower set of cases. It works when you know the consuming code expects real Booleans and you can confirm that no field uses the strings "true" or "false" as genuine text. The decisive tradeoff is that conversion fixes type mismatches but can silently change meaning. For example, a free-text field might legitimately contain the word true. Leave values as plain, unconverted text when an API contract specifies strings, when you cannot inspect every field, or when the data will be compared against an original byte for byte.
Will the result stay usable after copying or sharing?
Valid JSON is plain ASCII-compatible text, so true and false survive copy and paste in ordinary editors and terminals. Problems tend to come from the route the text takes, not from the literals themselves.
- Word processors and some chat or note apps may replace straight quotes with curly quotes. JSON parsers reject curly quotes around keys and strings.
- Styled Unicode text, such as bold or italic letter look-alikes from font generators, uses different code points. A styled version of true looks right but is not the literal true, and parsing fails.
- Some destinations may auto-capitalize the first word of a line, turning true into True. Whether a particular app does this was not verified here.
- Spreadsheet imports may interpret TRUE and FALSE according to their own rules. This can change case or type when the data is exported back to JSON.
For sharing, send JSON as a file or inside a code block rather than as formatted prose, then re-validate it after pasting. If the recipient needs a human-readable explanation, pair the raw JSON with a plain-text note, for example: "enabled is set to true."
On accessibility, pretty-printed JSON with one key per line is generally easier to follow, including for people navigating line by line. Minified JSON puts everything on one long line. No documentation or test results were supplied about how specific screen readers announce JSON Booleans, so treat any claim about a particular assistive technology as unverified until it has been tested in that environment.
Gaps in the available evidence
This overview relies on the JSON standard and widely documented language behavior. No measurements, tool comparisons or test results were supplied. Nothing here describes how a particular online formatter or converter behaves, or how it handles the data you paste into it. If the JSON contains sensitive values, check that tool's own stated data policy before using it, or use a local utility instead.