Reference

boolean

The boolean type matches only two special values: true and false. Note that values that evaluate to true or false, such as 1 and 0, are not accepted by the schema.

Language-specific info:
Python
Ruby
Objective-C
Swift

In Python, "boolean" is analogous to bool. Note that in JSON, true and false are lower case, whereas in Python they are capitalized (True and False).

Copy icon
 logo-white schema
{ "type": "boolean" }
Copy icon
data
true
Checkmark iconcompliant to schema
Copy icon
data
false
Checkmark iconcompliant to schema
Copy icon
data
"true"
Error iconnot compliant to schema

Values that evaluate to true or false are still not accepted by the schema:

Copy icon
data
0
Error iconnot compliant to schema

Need Help?

Did you find these docs helpful?

Help us make our docs great!

At JSON Schema, we value docs contributions as much as every other type of contribution!

Still Need Help?

Learning JSON Schema is often confusing, but don't worry, we are here to help!.