> codebench_TOOL: HomeLOCAL-ONLY⌘K Switch

JSON Schema Validator

Tool guide

Validate JSON data against a JSON Schema definition

Input: This tool processes input in your browser. Check in Network (opens in a new tab)

Draft:
Sample:
JSON Data
JSON Schema

Paste JSON data and a JSON Schema to validate structure, types, and constraints. Supports Draft 2020-12, Draft 7, Draft 6, and Draft 4. Shows all validation errors with JSON pointer paths, failed keywords, and expected values. Powered by ajv. All processing runs in your browser.

How to use it

  1. Paste the reservation into JSON Data and the rules into JSON Schema. Select Draft 2020-12 (latest) and enable All Errors.
  2. Click Validate. Read the two error rows before changing either field: the first is about the type of seats, and the second is about the value of zone.
  3. Replace the data with {"seats":2,"zone":"balcony"}, leave the schema alone, and validate again. The status changes to Valid.

Worked example

JSON Data
{"seats":"2","zone":"roof"}
JSON Schema
{
  "type": "object",
  "properties": {
    "seats": { "type": "integer" },
    "zone": { "enum": ["floor", "balcony"] }
  },
  "required": ["seats", "zone"]
}
Example output
Invalid (2 errors)
/seats  type  must be integer
/zone  enum  must be equal to one of the allowed values

The paths identify the offending fields in the data and the keywords identify the failing rules. Quoted "2" parses as JSON but does not satisfy integer; roof is a string but is not in the allowed list.

What to watch for

Validation does not coerce strings to numbers or repair bad data. If the validator cannot even parse or compile the inputs, check Logs rather than interpreting an empty error list as success.

Frequently asked question

Why does a missing required field point to / rather than to that field?
The field is absent, so the required rule fails on its containing object. At the document root the tool displays /; the message names the missing property.

Browse JSON tools

Further reading

> codebench $Ctrl+Enter Run