Skip to main content
Use "type": "integer" when decimal values are not valid.

Common constraints

{
  "type": "object",
  "properties": {
    "count": { "type": "integer", "minimum": 0 },
    "priority": { "type": "integer", "minimum": 1, "maximum": 5 },
    "even_id": { "type": "integer", "multipleOf": 2 }
  },
  "required": ["count", "priority", "even_id"],
  "additionalProperties": false
}
integer supports the same numeric bound keywords as number (minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf).

When to use

  • Use integer for counters, indexes, and IDs.
  • Use number when decimals are allowed.