JSON Schema Validator

Validate JSON against a JSON Schema online. See exactly which fields fail validation with clear error messages. Free, no signup, runs in browser.

JSON SchemaValidation errorsFreeRuns in browser
JSON Schema
JSON to validate
Advertisement

JSON Schema Validation — Catching Data Errors Before They Cause Bugs

A bug that could be caught at the API boundary should never reach your database. JSON Schema validation is the gatekeeper — it inspects incoming data against a defined contract and rejects anything that doesn't conform before your application code ever touches it. This shifts error detection from runtime crashes to clear, actionable validation messages at the point of entry.

Schema validation vs type checking

TypeScript types catch errors at compile time in your code. JSON Schema validation catches errors at runtime in your data. They solve different problems. A TypeScript interface defines what shape your code expects. A JSON Schema validates that external data — from users, APIs, webhooks — actually matches that shape before you process it. Both are necessary; neither replaces the other.

What AJV validates

This tool uses AJV (Another JSON Validator), the most widely-used JSON Schema library. It validates types (string, number, boolean, array, object), string constraints (minLength, maxLength, pattern), number ranges (minimum, maximum), required properties, array item types, string formats (email, date, uri), and enum values. Error messages include the exact field path where validation failed.

Adding validation to your API

In Express.js with AJV: compile your schema once at startup, then call validate(requestBody) in your route handler. If validation fails, return a 422 status with the error details. In FastAPI (Python), JSON Schema validation is built in via Pydantic models. In any framework, validating input at the API boundary is cheaper than debugging corrupted data in your database weeks later.

Frequently asked questions

What is JSON Schema?
JSON Schema is a vocabulary that allows you to validate, annotate, and describe the structure of JSON documents. It defines required fields, data types, string patterns, number ranges, and more.
Which JSON Schema version does this use?
This validator supports JSON Schema Draft 2020-12 (the latest standard) via the AJV library, which is the most widely used JSON Schema validator.
How do I mark a field as required?
Add the field name to the "required" array at the root level of your schema: {"required": ["name", "email"]}. Fields not in the required array are optional.
What does format:"email" validate?
The format keyword validates string formats like email, date, date-time, uri, and uuid. AJV validates these strictly — "not-an-email" will fail the email format check.
Can I validate nested objects?
Yes. Use the properties keyword for nested objects recursively. Each nested object can have its own type, properties, and required constraints.
Is my data safe?
Yes. All validation runs in your browser using AJV. Nothing is uploaded anywhere.