not : Schema



An instance is valid against this keyword if it fails to validate successfully against the schema defined by this keyword.

Value This keyword must be set to a valid JSON Schema
Kind Applicator
Applies To Any
Dialect 2020-12
Changed In None
Introduced In Draft 4
Vocabulary Applicator
Official Tests draft2020-12/not.json
Default false
Annotation None
Affected By None
Affects None
Also See

The not keyword is used to declare that an instance only validates if it doesn’t validate against the given subschema. It is essentially a way to define a rule that an instance should not match.

  • The boolean false schema, can be thought as an alias to { not: {} }.

Annotations are dropped when an instance fails. Therefore, in the case of not, annotations are always dropped because:

  1. If the subschema of not passes (producing annotations), then not itself fails, resulting in the annotations being dropped.
  2. If the subschema of not fails, no annotations are produced, and there is nothing for not to pass on.


Schema with 'not' keyword Schema
  "$schema": "",
  "not": {
    "type": "string"
Valid An instance with values other than string is valid Instance
Invalid An instance with a string value is invalid Instance
Schema with 'not' set to false Schema
  "$schema": "",
  "not": false
Valid Any instance is valid against the above schema Instance
{ "foo": "bar" }
  • Since the boolean false schema is equivalent to { "not": {} }, the overall schema translates to { "not": { "not": {} } }, which is equivalent to an empty object schema ({}). Therefore, every instance passes against the above schema.