JSON & Schema

JSON Schema additionalProperties Explained

Object schemas allow additional properties by default. Set additionalProperties to false to reject unmatched keys, or provide a schema to validate their values.

Published

The default: extra properties are allowed

Without an additionalProperties rule, a debug or metadata field does not fail validation merely because it is absent from properties.

{ "type": "object", "properties": { "name": { "type": "string" } } }

Reject unknown fields with additionalProperties: false

{
  "type": "object",
  "properties": { "name": { "type": "string" } },
  "required": ["name"],
  "additionalProperties": false
}

Validate extra properties with a schema

{ "type": "object", "additionalProperties": { "type": "string" } }

properties vs patternProperties vs additionalProperties

KeywordMatches
propertiesExact property names
patternPropertiesNames matching a regular expression
additionalPropertiesNames unmatched by the first two

Composed schemas and unevaluatedProperties

additionalProperties is evaluated within its schema location, which can surprise authors using allOf. unevaluatedProperties can express a later boundary in newer drafts, but use it only with a validator and declared draft that support it.

Common mistakes

  • Assuming objects are closed by default.
  • Forgetting required when a known field must exist.
  • Using additionalProperties: false inside one allOf branch and expecting it to see sibling properties.
  • Changing an API to a closed schema without compatibility review.

Try the example

Observe an extra object field

Generate a baseline from a sample that includes a debug field before choosing a closed contract.

{"name":"Alice","age":30,"debug":true}

Expected result: The generated schema includes all observed fields and keeps policy decisions explicit.

Try the example

Reject an unknown debug field

Use a closed object schema and inspect the additional-property error.

additionalProperties: false
data: {name, age, debug}

Expected result: Validation rejects debug as an additional property.

Start from a sample

Generate the object structure

Generate known properties, then choose the extra-field policy your contract requires.

Open JSON to JSON Schema Generator →