Home › Developer Tools › JSON Schema Validator

JSON Schema Validator

Paste a JSON Schema on the left and your JSON data on the right. Validation runs as you type with the Ajv engine, and every error shows the JSON pointer, the failing keyword and the line it is on. Click an error to jump to it.

Last updated:

…
Validating…

Advertisement
Advertisement

How to use the JSON Schema Validator

  1. Paste your JSON Schema in the left editor, or upload a .json schema file. Pick a sample to start from an example.
  2. Paste the JSON data you want to check in the right editor.
  3. Choose the draft or leave it on Auto to use the $schema keyword. Validation runs as you type.
  4. Read the result. Green means the data is valid. Otherwise each error lists the JSON pointer, the message and the schema keyword that failed.
  5. Click an error to select the offending value in the data editor, fix it and watch the list update.

JSON Schema keywords at a glance

A JSON Schema is itself a JSON object made of keywords. Each keyword adds one rule, and the data is valid only when every rule passes. These are the keywords you will use most:

Applies toKeywordsExample
Any valuetype, enum, const{"type": ["string", "null"]}
StringsminLength, maxLength, pattern, format{"type": "string", "format": "email"}
Numbersminimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf{"type": "integer", "minimum": 0}
Objectsproperties, required, additionalProperties, patternProperties, propertyNames, minProperties{"required": ["id"], "additionalProperties": false}
Arraysitems, prefixItems, minItems, maxItems, uniqueItems, contains{"type": "array", "items": {"type": "string"}}
CombiningallOf, anyOf, oneOf, not, if / then / else{"anyOf": [{"type": "string"}, {"type": "number"}]}
Reuse$ref, $defs (2019-09+), definitions (draft-07), $anchor{"$ref": "#/$defs/address"}

Reading the error list

Each error has three parts. The path is a JSON Pointer to the value in your data, for example /items/1/price is the price of the second item. The keyword is the schema rule that failed, such as required or pattern. The schema path points to that rule inside the schema, such as #/$defs/item/properties/price/minimum, so you can tell whether the data or the schema needs fixing.

When a value fails anyOf or oneOf, the validator lists why each branch failed (indented) followed by the summary error. Usually only one branch was meant to apply, so look for the errors under the branch that matches your intent. A common trick is adding a const discriminator, such as "type": {"const": "click"}, to every branch.

Common schema mistakes

  • Typos in keywords are silently ignored. "minLenght": 3 or "require": ["id"] are unknown keywords, so nothing is checked. If a rule seems to have no effect, check the spelling.
  • required belongs to the object, not the property. Write {"properties": {"id": {...}}, "required": ["id"]}, not {"id": {"required": true}} (that was draft-03 syntax).
  • additionalProperties: false does not see through allOf. Properties declared in another subschema count as additional. Use unevaluatedProperties: false (2019-09 and later) when combining schemas.
  • Array-form items is a tuple only before 2020-12. In 2020-12 use prefixItems for positions and items for the rest.
  • integer accepts 1.0. JSON Schema compares numbers mathematically, so 1.0 is a valid integer but 1.5 is not.

Frequently asked questions

What is a JSON Schema validator?

It checks whether a JSON document matches the rules in a JSON Schema: the required properties, data types, allowed values, string patterns, number ranges and array lengths. The result is either valid or a list of every rule the data breaks.

Which JSON Schema drafts are supported?

Draft-07 (which also covers most draft-04 and draft-06 schemas), draft 2019-09 and draft 2020-12. Leave the draft on Auto and the validator reads the $schema keyword; a schema without $schema is treated as draft-07.

What does the error path mean?

The path is a JSON Pointer (RFC 6901) to the value that failed. /items/2/price means the price property of the third element of the items array; an empty path means the root value. The schema path shows which keyword in the schema produced the error.

Are formats like email and date-time checked?

Yes, when Check formats is on. The validator understands date, time, date-time, duration, email, hostname, ipv4, ipv6, uri, uri-reference, uuid, regex and json-pointer. In the JSON Schema standard, format is only an annotation unless the validator chooses to assert it, so you can switch it off.

Can it resolve $ref to other files or URLs?

It resolves references inside the same schema, such as #/definitions/address, #/$defs/item, $anchor names and $id-based references. Remote references to other files or URLs are not downloaded, so inline those definitions under $defs first.

What is the difference between draft-07 and 2020-12?

2020-12 renamed definitions to $defs, replaced array-form items with prefixItems, split dependencies into dependentRequired and dependentSchemas, and added unevaluatedProperties, unevaluatedItems, minContains and maxContains. Draft 2019-09 introduced most of these changes.

Is my data sent to a server?

No. The schema and the JSON are validated by JavaScript in your browser, so private API payloads and configuration files never leave your device.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

JSON Schema GeneratorTurn sample JSON into a draft 2020-12 JSON Schema with types, required fields and formats.JSON ValidatorCheck JSON with the exact line and column of each error, fix tips and one-click auto-fix.JSON FormatterBeautify, minify and validate JSON, with a collapsible tree view.JSON to TypeScriptGenerate TypeScript interfaces or types from JSON, with nested types and optional fields.Kubernetes YAML ValidatorValidate Kubernetes manifests against the API schema of a chosen version, with error paths.SQL Formatter & BeautifierFormat, beautify or minify SQL queries for MySQL, PostgreSQL and more.JavaScript BeautifierFormat and beautify messy or minified JavaScript, or minify it.HTML FormatterBeautify and indent HTML code with a live preview.CSS FormatterBeautify CSS with indent controls and optional property sorting.XML FormatterBeautify, validate and minify XML with a collapsible tree view.ZIP File CreatorCompress files and folders into a ZIP.YAML Validator & FormatterValidate, format and minify YAML, and convert YAML to JSON or back.HTML MinifierMinify HTML: strip comments and whitespace safely and see how many bytes you save.CSS MinifierMinify CSS with csso or a built-in engine and see the size saved instantly.JavaScript MinifierMinify JavaScript with Terser: compress, mangle and see how many bytes you save.JSON MinifierMinify and validate JSON, sort keys and see exactly how many bytes you save.Code Diff CheckerCompare two code files side by side or unified, with syntax colors and changes highlighted.IPv6 Expander & CompressorExpand IPv6 addresses to full form or compress them per RFC 5952, one or many at once.GraphQL FormatterPretty-print and indent GraphQL queries, mutations and schemas, or minify them, instantly.CSS ValidatorValidate CSS: syntax errors, unknown properties and invalid values by line, plus auto-fix.Gzip Compress / DecompressGzip or deflate text and files, get Base64 output, and decompress Base64 or .gz files.IBAN ValidatorCheck an IBAN's mod-97 checksum, country and length, and see its bank code and account parts.JavaScript Syntax CheckerCheck JavaScript for syntax errors with line and column, for any ES version, script or module.Markdown FormatterBeautify Markdown with Prettier: list markers, prose wrap, aligned tables and live preview.PHP FormatterBeautify PHP code with Prettier PHP: PSR-12 style, indent and brace options, syntax errors.TypeScript FormatterFormat TypeScript and TSX code with Prettier: width, tabs, semicolons and quotes options.XML MinifierMinify and validate XML: strip whitespace and comments, keep CDATA, see the size savings.C# FormatterBeautify C# code online: Allman or K&R braces, indent size and line width, clang-format option.HTML ValidatorCheck HTML for errors and warnings with line numbers, locally or with the W3C Nu checker.Java FormatterBeautify Java code online: indent size, brace style and line width, with clang-format option.JavaScript ObfuscatorObfuscate JavaScript with string encoding, renaming and control-flow flattening presets.Phone Number FormatterFormat and validate lists of phone numbers to E.164, international or national style.Python FormatterFormat Python code in Black/Ruff style: line length, quote style, indent, copy or download.Responsive Design CheckerPreview any website at phone, tablet, laptop and desktop sizes side by side, with rotate and zoom.Browser Compatibility CheckerSearch CSS, JavaScript and HTML features and see which browser versions support them.Core Web Vitals CheckerCheck real-user LCP, INP and CLS for any URL or site and see if it passes Core Web Vitals.Heading Structure CheckerPaste HTML to see its H1-H6 outline and catch missing H1s, multiple H1s and skipped levels.Website Hosting CheckerFind out who hosts a website: hosting provider, IP addresses, ASN, network owner and location.Strftime Format BuilderBuild Python and C strftime format strings by clicking tokens, with a live preview and reference.Routing Number ValidatorCheck a US ABA routing number's checksum and format and see its Federal Reserve district.Spam Word CheckerScan an email subject and body for spam trigger words, excess caps, exclamation marks and risky links.Check Digit CalculatorCalculate or validate check digits for UPC, EAN, GTIN, SSCC, ISBN, ISSN and mod 11 codes.Luhn Algorithm CheckerValidate numbers with the Luhn mod 10 check or calculate the missing check digit, step by step.XSD ValidatorValidate XML against an XSD schema in your browser and see each error with its line number.
See all 41 Code Formatters & Validators →