JSON Schema ValidatorONLINE

Check your JSON against a supplied Draft 7 schema and see where it fails.

1 MiB per input · Ctrl / ⌘ + Enter to run

Draft 7 · local references only · syntax validation and schema validation are separate checks.

Validation report
Ready. Paste input, then run the tool.
Your JSON stays in your browser. Core processing happens locally.
THE PRACTICAL GUIDE

Validate an API payload against a JSON Schema contract

A JSON Schema states the shape and constraints expected by an application. This validator checks a JSON instance against a supplied Draft 7 schema after checking both documents for valid JSON syntax.

When should you use it?

  • Check required API fields before integration.
  • Verify types, ranges, patterns, and array rules.
  • Locate the rule that rejects a configuration value.
WORKED EXAMPLE

Example: syntax passes, schema fails

Paste the document and schema into their respective inputs. The report returns valid: false, with instanceLocation #/age and keywordLocation #/properties/age/type. Changing "20" to 20 makes this example pass; the rule checks type without converting the value.

Document
{"age":"20"}
Schema (paste in the second input)
{"type":"object","properties":{"age":{"type":"integer"}}}

Define presence, type, and allowed values separately

The properties keyword describes a field when it exists. The required array decides whether it must exist at all. For example, declaring an integer id under properties still permits {} until id also appears in required. An empty string is present, so use minLength when a name must contain text. A field with null also needs null in its allowed types if null is a valid value.

Use enum for a fixed set of status values and numeric bounds for quantities that have a real range. Add additionalProperties: false only when unknown fields should be rejected. An overly strict schema can prevent a client from accepting a harmless new field; an overly loose one can hide a misspelled property.

Use the dialect supported by this validator

This tool validates Draft 7 schemas. Put reusable definitions in the same schema and refer to them with local references such as #/definitions/address. It does not fetch remote references, so a URL in a reference is not an instruction to download another schema. Bundle the needed definitions before checking a payload here.

A passing result means the supplied instance satisfies the supplied rules. It does not prove that the rules capture every business requirement. Test a known valid example and deliberately invalid examples, such as a missing id, a string-valued quantity, and an unexpected status. This checks that the schema rejects the mistakes you actually want to catch.

AT THE WORKBENCH

Check the contract behind the syntax.

A valid JSON document can still have a missing field or wrong type. Supply a schema to check the structure your application expects.

  1. Supply both documents

    Paste data and a Draft 7 JSON Schema, or open local files.

  2. Run the contract check

    The schema itself is checked before your document is evaluated.

  3. Inspect the report

    Read instanceLocation and keywordLocation to locate the failing rule.

IN PRACTICE

How do I check required fields and types in a JSON API payload?

Put the payload in the data input and a Draft 7 schema in the schema input. A property listed under properties gets a type rule, but it is optional unless its name also appears in required. When validation fails, inspect the instance and keyword locations to find the affected value and rule.

Draft 7 schema: require an integer id

json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {"id": {"type": "integer"}},
  "required": ["id"]
}

The instance {"id":"7"} fails because its id is a string. The instance {} fails because id is absent.

It validates Draft 7 with references inside the supplied schema only. External reference URLs are not downloaded; use a self-contained schema or resolve references before using the page.

BEFORE YOU USE THE RESULT

What should you check before using the result?

Remote references are never fetched, and other schema drafts are not implied. JavaScript numeric precision applies to schema calculations, so review precision-sensitive rules separately.

Supported schema behavior

This tool supports Draft 7, including required fields, types, patterns, arrays, conditionals, and local references. It stops at the first failing branch. External reference URLs are never downloaded; unresolved references produce an error. Other drafts must be converted deliberately before use.

Numbers and unknown keywords

Schema checks use JavaScript numbers. Non-finite values and unsafe integers are rejected instead of silently rounded. Fractions follow binary floating-point behavior. Unknown annotation keywords do not enforce constraints. The formatter remains available for lossless text handling.

Understand JSON Schema

Technical reference: JSON Schema Draft 7 validation specification

THE JSON FIELD GUIDE
All guides