JSON Schema Validator — Validate JSON Against Schema

Validate JSON against a JSON Schema directly in your browser. This tool highlights errors with clear messages and pinpoint line numbers, so you can debug faster. Perfect for developers working with APIs, microservices, or configuration files that require strict schema validation.

Schema
No file
JSON Input
No file
// Validate JSON against schema

What this tool does

This validator checks whether a JSON document conforms to a JSON Schema. It’s ideal for contract testing, API payload validation, and config safety. Paste a schema on the left, your JSON on the right, then click Validate. All processing happens locally in your browser—no uploads, no logging.

How it works (high level)

  • Parsing: Both the schema and input must be valid JSON.
  • Compilation: The schema is compiled with Ajv for fast validation.
  • Validation: The JSON is checked against the compiled rules; errors include a path and message.

Step-by-step

  1. Paste or upload your schema and JSON input.
  2. Use Beautify to normalize indentation for easier reading.
  3. Click Validate to run checks. If valid, you’ll see a green confirmation.
  4. If invalid, review the error list (path, keyword, message) and fix your JSON or refine the schema.

Examples

Sample schema (draft-07):

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "id":   { "type": "integer", "minimum": 1 },
    "name": { "type": "string",  "minLength": 1 },
    "tags": { "type": "array", "items": { "type": "string" } }
  },
  "required": ["id","name"],
  "additionalProperties": false
}

Typical error output:

[
  {
    "instancePath": "/id",
    "keyword": "minimum",
    "message": "must be >= 1"
  },
  {
    "instancePath": "",
    "keyword": "required",
    "params": { "missingProperty": "name" },
    "message": "must have required property 'name'"
  }
]

Best practices

  • Declare a draft: Set $schema (e.g., draft-07 or 2020-12) at the root of your schema.
  • Be explicit: Use additionalProperties: false to block unexpected fields.
  • Validate arrays carefully: Combine minItems, uniqueItems, and items constraints.
  • Use formats wisely: format (email, uri, date-time) is helpful, but treat it as a hint unless strict checks are required.
  • Document enums: Pair enum with descriptions so consumers know allowed values.

Drafts & compatibility

The example schema uses draft-07. Newer drafts (2019-09, 2020-12) introduce annotations and vocabularies. If you switch drafts, update the $schema URL accordingly and ensure your tooling matches.

Troubleshooting

  • “Unexpected token”: Your schema or JSON isn’t valid JSON—run Beautify and fix commas/quotes.
  • Paths look odd: instancePath is a JSON-Pointer; /items/0/name points into arrays/objects.
  • No errors but data still breaks downstream: Tighten your schema with required, enum, minLength, etc.

Privacy & performance

Validation is 100% client-side, so sensitive payloads never leave your browser. Compiled schemas are fast, making it usable for large examples during development and reviews.

Need to massage data before/after validation? Try our Converter, Validator, and Diff tools.

FAQ

What is JSON Schema?

A standard for describing the structure, types, and validation rules of JSON documents so producers and consumers can agree on a contract.

Which drafts are supported?

Widely used drafts such as draft-07 and 2020-12 work well. Declare your draft at the root with a $schema URI so validators know which vocabulary to use.

How do I require properties?

Add a 'required' array at the same level as 'properties', e.g. { "required": ["id","name"] }. Missing fields will be reported with clear error messages.

How do I block unexpected fields?

Set "additionalProperties": false to disallow keys not listed in 'properties'. For fine-grained control, set it to a subschema (e.g., a pattern or type) instead of false.

How do I allow null values?

Use a union that includes "null", e.g. { "type": ["string","null"] }. (Prefer this over non-standard 'nullable'.)

What's the difference between number and integer?

"integer" matches whole numbers only; "number" matches integers and floats. Combine with "minimum", "maximum", or "multipleOf" for constraints.

How do I validate arrays?

Use "items" for element shape, plus "minItems"/"maxItems" and "uniqueItems". For tuple validation, make "items" an array of schemas and optionally set "additionalItems": false.

What are oneOf, anyOf, and allOf?

oneOf = exactly one schema must match; anyOf = at least one must match; allOf = all must match. Use discriminator-like properties to avoid ambiguous oneOf matches.

How strict are 'format' checks (email, uri, date-time)?

Formats are best-effort hints. For production-grade strictness, pair 'format' with 'pattern' or custom business rules.

Can I reuse parts of my schema?

Yes. Define shared subschemas under "$defs" (or "definitions" in older drafts) and reference them with "$ref". Add an "$id" to give your schema a stable reference base.

Why does my JSON still pass with extra keys?

By default, additional properties are allowed. Set "additionalProperties": false (or a schema) to fail on unknown keys.

Does the validator coerce types or apply defaults?

No. Input must already be the right type, and 'default' is documentation/annotation-it is not automatically injected. Normalize data before validating if needed.

Do property order or comments matter?

Property order in JSON is not significant, and JSON comments aren't allowed. If you need comments, use JSON5 at author time and transpile to JSON before validation.

Can I validate nested objects and deep paths?

Yes. Use nested 'properties' with 'required' at each level, and inspect error paths (e.g., /items/0/name) to jump straight to the offending field.

Is my data uploaded to a server?

No. All tools run locally in your browser; your data isn't sent to any server.

Can I use the tool offline?

After the page loads once, most browsers will allow basic offline usage because processing is entirely client-side.

Can I beautify JSON?

Yes - use the Beautify actions in each tool where applicable.

Do you keep my files?

No. All tools run locally in your browser; data is not uploaded to any server.

Is there a size limit?

Large inputs are limited by your browser memory; for most cases typical files work fine.

Is it free?

Yes, All tools are 100% free and no sign-up required.