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:

schema
{ "properties": { "country": { "const": "United States of America" } }}
data
{ "country": "United States of America" }
compliant to schema
data
{ "country": "Canada" }
not 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!.