Reference

Constant values

New in draft 6

The const keyword is used to restrict a value to a single value.

For example, if you only support shipping to the United States for export reasons:

Copy icon
 logo-white schema
{ "properties": { "country": { "const": "United States of America" } }}
Copy icon
data
{ "country": "United States of America" }
Checkmark iconcompliant to schema
Copy icon
data
{ "country": "Canada" }
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!.