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
1
{
2
"properties": {
3
"country": {
4
"const": "United States of America"
5
}
6
}
7
}
data
1
{ "country": "United States of America" }
compliant to schema
data
1
{ "country": "Canada" }
not compliant to schema

Need help?

Learning JSON Schema is often confusing, but don't worry, we are here to help! You can start a thread on GitHub Discussions, connect with us on Slack, or join our live Office Hours.
We'd love to help!! ❤️