How do I validate JSON against a JSON Schema online?
Paste your JSON data and JSON Schema (Draft 07) to instantly validate the data against the schema. The tool reports all validation errors with paths to the failing fields. You can also generate a schema from sample JSON data. Everything runs in your browser — your data never leaves your device.
Schema: { "type": "object",
"required": ["name", "age"] }
Data: { "name": "Alice", "age": 30 }✓ Valid All required properties present Type checks passed: 2/2
JSON Schema Validator
Validate JSON data against a JSON Schema (Draft 07) with detailed error reporting. Generate schemas from sample data or load examples to get started.
JSON Schema Quick Reference
JSON Schema is a vocabulary for annotating and validating JSON documents. It describes the structure, constraints, and documentation of JSON data.
type— Data type: string, number, integer, boolean, object, array, nullrequired— Array of required property namesproperties— Object property schemasitems— Schema for array elementsenum— Allowed valuespattern— Regex pattern for stringsminimum / maximum— Number range constraintsminLength / maxLength— String length constraintsformat— Semantic format: email, uri, date-time, ipv4, uuid, etc.additionalProperties— Allow or deny extra properties on objects
allOf— Must match all schemasanyOf— Must match at least one schemaoneOf— Must match exactly one schemanot— Must not match the schema
This tool supports JSON Schema Draft 07 with format validation (email, URI, date-time, etc.) via ajv-formats. Everything runs in your browser — no data is sent over the network.
Tips & Best Practices
Use $ref to keep schemas DRY and maintainable
Instead of repeating the same address object definition in user, order, and shipping schemas, define it once in $defs and reference it: {"$ref": "#/$defs/address"}. This mirrors how TypeScript interfaces work. Changes to the address schema automatically propagate to all references.
additionalProperties defaults to true — your schema allows anything
Without "additionalProperties": false, a schema requiring {name, email} happily accepts {name, email, isAdmin: true}. This is a common source of mass assignment vulnerabilities. Always set additionalProperties explicitly. Use "additionalProperties": false in strict APIs and true only when extensibility is intentional.
Combine allOf, oneOf, anyOf for complex validation
allOf: all schemas must match (intersection, like TypeScript &). oneOf: exactly one must match (discriminated union). anyOf: at least one must match (union, like TypeScript |). Use oneOf with a discriminator field for tagged unions: {"oneOf": [{type: "card"}, {type: "bank"}], "discriminator": {"propertyName": "type"}}.
Validate schema constraints server-side, not just client-side
Client-side JSON Schema validation improves UX but provides zero security. Attackers bypass your frontend entirely. Every API endpoint must validate request bodies server-side against the schema. Use AJV (JavaScript), jsonschema (Python), or similar libraries as middleware in your API handler.
Frequently Asked Questions
What is JSON Schema and why use it for API validation?
How do I define optional vs required fields in JSON Schema?
What is the difference between JSON Schema Draft-07 and Draft 2020-12?
Related Inspect Tools
JSON Visualizer
Visualize JSON as an interactive tree — collapsible nodes, search, path copy, depth controls, and data statistics
Git Diff Viewer
Paste unified diff output from git diff and view it with syntax highlighting, line numbers, and side-by-side or inline display
Compression Tester
Test and compare Brotli, Gzip, and Deflate compression ratios for text content — sizes, savings, and speed
TypeScript 6.0 Migration Checker
Analyze your tsconfig.json for TS 6.0 breaking changes, deprecated options, new defaults, and get a readiness grade with fixes