Tester Tool

JSON Schema Validator

Validate an API payload against a JSON Schema, or generate a draft schema from a sample. Ajv runs in your browser.

Draft 07 + 2020-12Generate schema100% Client-Side

Validate API payloads against a contract

You have a schema, or you should. Paste it on the left, paste an instance on the right, and Validate. Ajv compiles the schema in the browser and lists every failing path.

Use this when a staging response “looks fine” but a required field disappeared or a number became a string. Pretty-printing alone will not catch that. The JSON Formatter & Validator still helps you read the payload first.

Generate a draft schema from a sample

Generate walks the instance and writes a draft schema: object, array, string, integer, number, boolean, null. Turn on Mark all object keys required if the sample is a complete fixture.

The output is a starting contract, not the contract. It will not know that plan is an enum or that email should use a format.

How to read validation errors

Errors use JSON Pointer paths. /seats plus must be integer means the instance value at seats failed the type keyword. / means the root object failed, often a missing required key.

Load Missing field and Type mismatch to see those two shapes without inventing data.

Draft 07 vs 2020-12 in this tool

Pick the draft your repo already uses. Ajv is created as ajv for Draft 07 and ajv/dist/2020 for 2020-12. Mixing a 2020-12 $schema with the Draft 07 compiler can produce confusing compile errors. Match the toolbar to the $schema string.

The official language is on json-schema.org.

What generated schemas get wrong

  • Empty arrays become { "type": "array", "items": {} }.
  • null is typed as null, not as an optional string.
  • Extra keys are allowed unless you add additionalProperties yourself.
  • Formats (email, uuid, date-time) are not inferred.

When you need types for a TypeScript file instead of a schema, use JSON to Types Converter.

How to use

  1. Choose Validate or Generate, then Draft 07 or 2020-12.
  2. Paste schema and instance, or use the samples.
  3. Run Validate or Generate Schema.
  4. Copy the schema or the error list.

Privacy

Schema and instance stay in the browser. Remote $ref URLs are not fetched.

Frequently Asked Questions

Which JSON Schema drafts are supported?

Draft 07 and 2020-12, compiled in the browser with Ajv. The selected draft is labeled in the toolbar. This is not a full OpenAPI validator.

Why is a remote $ref rejected?

The tool does not fetch http or https $ref targets. That would send your work to another host and open SSRF-style requests. Inline the referenced schema.

Is a generated schema ready for production?

No. Generation infers types and optional required keys from one sample. It will not invent enums, formats, or additionalProperties rules you have not shown.

How do I read a validation error?

Each error includes an instance path such as /seats and the failed keyword. Use Valid sample, Missing field, and Type mismatch to see the three common cases.

Is my payload uploaded?

No. Ajv runs in the page. There is no validate API.