### Instance and schema

Instance JSON_{ "age": 21 }_JSON Schema_{ "type": "object", "properties": { "age": { "type": "integer", "minimum": 0 } }, "required": \["age"\] }_

Clear  Copy

Parse errors only: [JSON validator](https://www.toolcomb.com/json-validator).

### Schema result Copy

Valid · compiled as 2020-12

Default age 21 is an integer ≥ 0, so the required property passes.

# JSON Schema Validator - Validate JSON Against a Schema

Check whether your JSON matches a schema. Find missing required fields, incorrect types and values outside the rules, then review the errors in your browser.

## What Is a JSON Schema Validator?

A **JSON Schema validator** checks whether data follows the rules described by a schema, such as required fields, types, number ranges and nested objects. A document can be valid JSON but still fail those rules. If your input cannot be parsed, check its syntax with the [JSON Validator](https://www.toolcomb.com/json-validator) or try [JSON Repair](https://www.toolcomb.com/json-repair) first. For a schema error, use the reported path and message to find the value that needs attention.

JSON Schema is the usual way APIs, form backends, and config loaders describe “this object is acceptable.” OpenAPI request bodies, Kubernetes CRDs, GitHub Actions inputs, and many CMS plugins publish a schema so clients can fail fast instead of discovering a 400 after the network round-trip. Draft 2020-12 is the dialect this tool compiles first. Older draft-07 documents often still compile after a fallback, which is why a second schema validator instance exists on this page.

The default instance is `{"age":21}`. The default schema requires an object with integer `age` ≥ 0. schema validator reports valid. That is the worked check. Change age to `-1` and `minimum` fails. Change it to the string `"21"` and `type` fails. Extra keys are allowed because the sample does not set `additionalProperties` to false - a closed object is a different contract you must write explicitly.

Compile uses schema validator’s 2020-12 dialect first. If compile throws because the schema is an older draft-07 document, the tool retries with schema validator draft-07. Draft-04 `exclusiveMinimum`-as-boolean quirks are not fully emulated. Remote `$ref` HTTP loads are not fetched - that would be a network side effect you did not ask for. Format keywords such as email are assisted by format checks; treat them as lints, not a complete RFC of every format string.

## How to Validate JSON Against a Schema - Step by Step

Validating a contract with this tool takes under a minute:

1. **Paste the instance JSON** - The left panel holds the document you want to check. The default is `{"age":21}`. You can replace it with any JSON value: object, array, string, number, boolean, or null.
2. **Paste the JSON Schema** - The schema must be a JSON object. The default requires an object with integer age greater than or equal to 0. Compile uses draft 2020-12 first, then draft-07 if needed.
3. **Read valid or the error list** - The right panel shows Valid or Invalid plus the dialect schema validator used. Failed keywords include an instancePath such as `/age` and a message such as must be integer.
4. **Fix the first failing keyword** - Change the instance or the schema, then re-read the panel. Nothing is uploaded. Copy the report if you want to paste it into a ticket.
5. **Tighten the contract when you need a closed object** - Add `additionalProperties: false`, `required` arrays, and nested `properties` until the schema matches the API you actually ship.
6. **Parse first if either side is broken JSON** - If the instance or schema will not parse, use the [JSON validator](https://www.toolcomb.com/json-validator) or [JSON repair](https://www.toolcomb.com/json-repair) before this page. schema validator never sees invalid text.

## JSON Schema Example - Valid Age vs Type Failure

Here is the default contract this page loads, plus the two cheapest ways to make it fail. The schema is unchanged in every row; only the instance changes.

### Schema - integer age, minimum 0, required

```
{
"type": "object",
"properties": {
"age": { "type": "integer", "minimum": 0 }
},
"required": ["age"]
}
```

### Instance - valid (default)

```
{"age": 21}
```

Result: **Valid (2020-12)**. 21 is an integer and is greater than or equal to 0. The required property is present.

### Instance - type failure

```
{"age": "21"}
```

Result: Invalid. schema validator reports something like `/age must be integer`. JSON Schema does not coerce strings to numbers. That is the whole point of a contract: `"21"` and `21` are different values.

### Instance - minimum failure

```
{"age": -1}
```

Result: Invalid. The type is still integer, but `minimum` rejects negative ages. A syntax validator would call this document perfectly legal JSON. Only a schema can say “legal JSON, illegal age.”

## When You Need JSON Schema Validation - Real-World Use Cases

### Checking API request bodies before you send them

OpenAPI and many internal style guides publish a JSON Schema for POST and PUT bodies. Pasting a payload here catches missing required keys, wrong types, and out-of-range numbers before the request leaves your machine. That is faster than reading a 400 from a staging cluster, and it does not require a mock server.

### Catching string-vs-number bugs in form JSON

HTML forms and some client libraries serialize numbers as strings. A syntax check will happily accept `{"age":"21"}`. A schema with `type: integer` will not. This is one of the most common production mismatches between a TypeScript interface that says number and a JSON body that says string.

### Governing configuration files

Tools that load JSON config - linters, deploy manifests, feature-flag dumps - often ship a schema even when they also parse with `JSON.parse`. Validating a local config against that schema finds unknown enums, missing required blocks, and accidental extra keys (once you set `additionalProperties` false) without starting the whole application.

### Teaching JSON Schema without installing schema validator

Draft 2020-12 vocabulary is easier to learn when you can change one keyword and see the error path update immediately. Students can keep the default age schema, then add `maximum`, `enum`, or nested `properties` without a Node toolchain. The dialect label in the result panel shows whether compile stayed on 2020-12 or fell back to draft-07.

### Reviewing vendor schemas before you adopt them

Third-party APIs sometimes publish a schema that is draft-07 while your stack assumes 2020-12, or the reverse. Compiling here is a cheap compatibility check. If 2020-12 throws and draft-07 succeeds, you know you need an older validator in CI or a schema upgrade - not a mystery production failure.

### Closing objects that should not grow extra keys

The default sample is an open object: extra properties pass. Many APIs want the opposite. Adding `additionalProperties: false` turns a typo such as `agge` into a validation error instead of a silently ignored field. That is a schema job. A formatter cannot see the typo; a syntax validator cannot see it either.

### Linting format keywords locally

format checks assists `email`, `uri`, and `date-time`. That is useful when you want a second pair of eyes on a payload that already parses. It is not a replacement for a dedicated email RFC library. Treat a format failure as a hint, then confirm against the spec your product actually promised.

### Separating “is JSON” from “is our JSON”

Incident write-ups often confuse a parse error with a schema error. If the document will not parse, this page never reaches schema validator. If it parses and still fails, the report is a contract failure. Keeping those two tools separate - this page versus the [JSON validator](https://www.toolcomb.com/json-validator) - makes the postmortem accurate.

## Schema vs Syntax vs Format - Which Tool to Use

Three nearby tools on this site answer three different questions. Using the wrong one wastes time and produces the wrong error story:

| Question | JSON Schema | JSON validator | JSON formatter |
| --- | --- | --- | --- |
| Is the text RFC 8259 JSON? | Assumes yes | ✓ primary | Side effect of parse |
| Does age have to be an integer ≥ 0? | ✓ |  |  |
| Pretty-print or minify |  |  | ✓ |
| instancePath keyword errors | ✓ |  |  |
| Trailing comma `{"ok":true,}` | Parse fails first | ✓ line/column | Parse fails |
| Draft 2020-12 compile | ✓ |  |  |
| Closed object via additionalProperties | ✓ |  |  |
| Human-readable indent |  |  | ✓ |

The general rule: **parse first, then contract, then pretty-print**. If the instance is not JSON, a schema cannot help. If it is JSON but the wrong shape, the formatter will happily indent the wrong shape. Schema is the middle step.

## Common JSON Schema Errors - What schema validator Reports

These are the failures this page is built to surface. They are not RFC 8259 syntax errors; they are contract errors after a successful parse:

- **Type mismatch.** `{"age":"21"}` against `type: integer` fails. Schema does not coerce. JavaScript might; JSON Schema must not if you asked for an integer.
- **minimum / maximum.** `{"age":-1}` against `minimum: 0` fails even though the JSON is legal. Exclusive variants depend on the draft you compiled.
- **required missing.** An empty object `{}` against the default schema fails because `age` is required. The instancePath is usually `/` with a message that lists missing properties.
- **additionalProperties.** The default sample allows extra keys. Once you set `additionalProperties: false`, a typo key becomes an error instead of a silent extra field.
- **Schema is not an object.** A schema that is an array or a primitive cannot compile. This page reports “Schema must be a JSON object.”
- **Instance or schema is not JSON.** Trailing commas, single quotes, and comments fail in `parseJsonDocument` before schema validator runs. The error names Instance or Schema plus line and column.
- **Compile failure / unknown dialect.** If 2020-12 throws and draft-07 also throws, you see the compile message. Draft-04 exclusiveMinimum-as-boolean quirks are not fully emulated.
- **Unresolved $ref.** In-document refs that cannot be resolved fail compile. Remote HTTP `$ref` is not fetched. Inline the definition or resolve it locally first.
- **format is a lint.** A failing `email` format is useful, not a guarantee that every RFC 5322 edge case was implemented. Confirm against the product spec.

## Privacy & Security - 100% Browser-Side schema validator

Instance JSON and schema JSON are compiled and evaluated in your browser with schema validator. No document is posted to a server. That makes the page usable for payloads that contain customer records, tokens, or internal field names - with the usual caveat that local storage on a shared machine is still on that machine.

Drafts are saved under a unique storage key for up to 30 days so you can refresh without losing the pair you were editing. Click Clear to restore the default `{"age":21}` instance and the integer minimum schema. Panel width is stored separately and is not the document. Remote schemas are never downloaded; a `$ref` to an HTTP URL will not leak the instance to a third host because this page does not follow that URL.

## Frequently Asked Questions

### What is JSON Schema validation?

JSON Schema validation checks whether a JSON value follows rules for types, required properties, ranges and other constraints. Valid JSON syntax alone does not guarantee that the data matches your schema.

### What does the default sample do?

The default instance is `{"age":21}` and the default schema is an object that requires age as an integer with minimum 0. schema validator reports valid. Change age to -1 and the minimum keyword fails. Change age to the string "21" and the type keyword fails. That is the worked check for this tool.

### Is this the same as a JSON validator?

No. A JSON validator only runs a parse and reports the first line and column if RFC 8259 fails. This page assumes both the instance and the schema are JSON, then applies the schema. If either side will not parse, fix that on the JSON validator first, then come back here.

### Which JSON Schema draft is supported?

The tool tries draft 2020-12 first and retries with draft-07 if the schema cannot be compiled. Check the draft shown with the result; older drafts and schemas with remote references may not work as expected.

### Are format assertions such as email enforced?

The tool checks common formats such as email, uri and date-time. A passing format check does not prove that an address exists or that the value meets every application-specific requirement.

### Does schema validation upload my data?

No. schema validator runs in the browser. The instance and schema stay in local storage for up to 30 days so you can resume a draft. Nothing is posted to a server. Do not paste production secrets if other people share the device.

### What happens if the instance or schema is not valid JSON?

The tool reports which input could not be parsed, with a line and column. Fix the JSON syntax before checking it against the schema. You can use JSON Validator or JSON Repair for small drafts.

### Does additionalProperties reject extra keys by default?

No. The default sample schema does not set additionalProperties to false, so extra keys are allowed. Add that keyword when you want a closed object. That difference is a common source of “it validated but the API still rejected it” surprises.

### Can I validate against a remote $ref?

Not over the network. Fetching a remote schema would be a side effect this page does not perform. Inline the referenced definitions, or resolve $ref locally before pasting. The compile error will name the problem if a $ref cannot be resolved in-document.

### Is this JSON Schema validator free?

Yes. No signup, no usage cap, and no premium dialect. Validate as many instance and schema pairs as you need. Processing stays on your device.

## Related JSON Contract & Validation Tools

Schema is one step in a JSON workflow. These pages cover parse, repair, files, and presentation:

- [JSON Validator](https://www.toolcomb.com/json-validator) - RFC 8259 syntax only, with line and column. Use it when the instance or schema will not parse.
- [JSON Formatter](https://www.toolcomb.com/json-formatter) - Pretty-print after the document is valid JSON. This schema page does not indent.
- [JSON Repair](https://www.toolcomb.com/json-repair) - Heuristic fixes for small broken drafts before you paste them here.
- [JSON5 Validator](https://www.toolcomb.com/json5-validator) - Unquoted keys and trailing commas. That dialect is not JSON Schema input.
- [JSON File Processor](https://www.toolcomb.com/json-file-processor) - Worker parse for files up to the documented 50 MB cap. Not a schema engine.
- [JSON Compare](https://www.toolcomb.com/json-compare) - Diff two instances after both pass the same schema.
- [JSON Query](https://www.toolcomb.com/json-query) - JSONPath extraction once the contract is satisfied.
- [JSON Editor](https://www.toolcomb.com/json-editor) - Edit objects as a table, then re-validate the result against your schema.

## Related Tools

Discover more free tools that might help with your next task.

[JSON Formatter Format and validate JSON data Use Tool](https://www.toolcomb.com/json-formatter)

[JSON Viewer View JSON data in a tree structure Use Tool](https://www.toolcomb.com/json-viewer)

[JSON Minifier Minify JSON data to reduce size Use Tool](https://www.toolcomb.com/json-minifier)

[JSON Editor Edit JSON in text, tree, and table modes. Works offline in the browser Use Tool](https://www.toolcomb.com/json-editor)

[JSON Query Query and transform JSON with JSONPath Use Tool](https://www.toolcomb.com/json-query)

[JSON Compare Diff two JSON documents path by path Use Tool](https://www.toolcomb.com/json-compare)

### Related guides

Read the how-to, then come back to this tool when you are ready to run it locally.

- [A JSON Validator Is Not JSON Schema (RFC 8259 vs a Contract) Valid JSON can still be the wrong document. Syntax (RFC 8259) is not draft 2020-12 schema. When to open ToolComb’s JSON validator, JSON Schema validator, or formatter - and what duplicate keys still hide.](https://www.toolcomb.com/blog/json-validator-is-not-json-schema)

[View All Tools](https://www.toolcomb.com/tools)
