liminfo

JSON Schema Validator

Free web tool: JSON Schema Validator

About JSON Schema Validator

The JSON Schema Validator is a browser-based tool that checks whether a JSON document conforms to a given JSON Schema definition. You paste your JSON data into the left panel and your schema into the right panel, click Validate, and the tool immediately reports whether the document is valid or lists each violation with its precise JSON Pointer path (e.g., /user/email) and a human-readable error message explaining what went wrong.

Software developers, API designers, and QA engineers use JSON Schema validation to enforce data contracts between services. The tool validates the core constraint keywords defined in the JSON Schema specification: type (string, number, integer, boolean, object, array, null), required property presence, properties with recursive sub-schema validation, string constraints (minLength, maxLength, pattern regex, enum values), numeric constraints (minimum, maximum), and array constraints (minItems, maxItems, items sub-schema). This covers the vast majority of real-world schemas used in REST APIs and configuration files.

Technically, the validator performs a depth-first traversal of the JSON document, matching each node against its corresponding schema fragment. For objects, it checks that all required keys are present and then recursively validates each defined property. For arrays, it validates length bounds and then applies the items sub-schema to every element. Errors accumulate into a flat list with JSON Pointer paths so you can pinpoint exactly which nested field failed and why.

Key Features

  • Side-by-side JSON document and JSON Schema editor panels with syntax highlighting
  • Type validation for all JSON types: string, number, integer, boolean, object, array, and null
  • Required field checking — reports missing required properties with their exact JSON Pointer path
  • String constraint validation: minLength, maxLength, pattern (regex), and enum (allowed values)
  • Numeric constraint validation: minimum and maximum for number and integer types
  • Array constraint validation: minItems, maxItems, and recursive items sub-schema per element
  • Recursive nested object validation — validates properties at any depth of nesting
  • Pre-loaded example with a user object schema so you can see the tool working immediately

Frequently Asked Questions

What is JSON Schema and what is it used for?

JSON Schema is a vocabulary for annotating and validating JSON documents. It is widely used to define the expected structure of API request and response bodies, configuration files, and database documents. Tools like Postman, OpenAPI/Swagger, and many IDE plugins use JSON Schema to provide autocompletion and inline validation.

Which JSON Schema version does this tool support?

The validator implements the core constraint keywords common to JSON Schema drafts 4, 6, 7, and 2019-09: type, required, properties, minLength, maxLength, pattern, enum, minimum, maximum, minItems, maxItems, and items. Advanced keywords like anyOf, oneOf, allOf, if/then/else, and $ref are not currently supported.

What does a JSON Pointer path like /user/email mean in an error?

JSON Pointer (RFC 6901) is a syntax for identifying a specific value within a JSON document. A path of /user/email means the error is in the email field inside the user object. A path of /items/[2]/name means the name field in the third element (index 2) of an array called items.

What is the difference between type "number" and type "integer"?

In JSON Schema, number accepts any numeric value including decimals (e.g., 3.14), while integer only accepts whole numbers with no fractional part (e.g., 42). The validator checks this by verifying that integer values pass Number.isInteger() in JavaScript.

How do I validate that a field matches a specific format like an email address?

Use the pattern keyword in your schema with a regular expression. For email-like validation you can use a pattern such as "^[^@]+@[^@]+$". The validator will test the string against the regex and report an error if it does not match. Full RFC 5322 email format validation is beyond regex and requires a dedicated library.

How do I make a field optional but still validate it when present?

Simply do not include the field name in the required array. Define it under properties with its constraints as usual. If the field is present in the JSON document, the validator will apply the schema constraints to it. If it is absent, no error is reported.

Can I validate a JSON array directly, not an object?

Yes. Set the top-level type in your schema to "array" and use minItems, maxItems, and items to define the constraints. The items sub-schema will be applied to every element in the array. Each element can itself be an object schema with its own required fields and properties.

Why does my JSON parse error appear before validation runs?

The tool first attempts to parse both the JSON document and the schema using JSON.parse(). If either contains a syntax error (missing quote, trailing comma, mismatched bracket), the parse fails and an error message is shown before any schema validation can occur. Fix the JSON syntax error shown in the error message first, then click Validate again.