JSON Schema Validator — Validate JSON Against a Schema
Understanding the Basics
Validating a JSON document against a JSON Schema is a foundational step in any API-driven architecture. While a simple JSON validator only checks that the syntax is well-formed, a schema validator enforces business rules: it confirms that required fields are present, that string values match regex patterns, that numeric values fall within defined ranges, and that arrays contain the expected number of items. This is particularly important when building microservices — each service can validate incoming payloads against a schema at the boundary before the data reaches business logic, preventing an entire class of runtime errors. JSON Schema validation is also the mechanism underlying OpenAPI/Swagger request-body validation, form validation libraries like Ajv and Joi, and configuration-file validation in tools like VS Code. Our tool uses the Ajv library (the fastest JSON Schema validator for JavaScript) running entirely in your browser, so you can test schemas against payloads with no server round-trip.
How to Use the Tool
- Paste your JSON Schema (draft-07 or draft-2019-09) into the left "Schema" editor.
- Paste the JSON document you want to validate into the right "Data" editor.
- Click "Validate" — Ajv evaluates every constraint in the schema against the document.
- If validation passes, a green success indicator is shown. If it fails, each validation error is listed with a JSON Pointer path (e.g., /users/0/email) and a human-readable message.
- Iterate: correct the data or the schema, and re-validate until all errors are resolved.
Key Features & Specifications
- Powered by Ajv — the most widely used and fastest JSON Schema validator for JavaScript
- Supports JSON Schema draft-07 and draft-2019-09
- Reports all errors simultaneously (not just the first one) with JSON Pointer paths
- Identifies missing required properties, wrong types, pattern mismatches, and enum violations
- Side-by-side dual-editor layout for schema and document
Frequently Asked Questions (FAQ)
- Q:What is a JSON Pointer and how do I read error paths?
- A JSON Pointer (RFC 6901) is a string like /users/0/email that navigates to a specific location in a JSON document. The leading / represents the root, each subsequent / is a property separator, and array indices are numeric. So /users/0/email means: root → users array → first element → email field.
- Q:Can I validate an array of objects against a schema?
- Yes. Set the schema root type to "array" and use the "items" keyword to describe each element. Ajv will validate every element in the array against the items sub-schema.
- Q:Why does my schema with $ref to an external URL not resolve?
- For security reasons, browsers block external URL fetches from client-side code. If your schema uses $ref to reference external schemas, you need to inline all referenced schemas before using this tool.