This JSON Schema generator turns a JSON sample into a ready-to-use JSON Schema, and the built-in validator checks any JSON document against a schema you provide. In Generate mode it walks your sample, infers types for objects, arrays, strings, numbers, booleans and null, unifies array items, and can mark every property required, set additionalProperties to false, and detect string formats like email, date, date-time, uri and uuid. Pick draft-07 or 2020-12 for the output. In Validate mode it checks the document against every rule in your schema, including format keywords, and lists each failure with its instance path and message. It is built for API developers, backend engineers and anyone defining or testing JSON contracts. Everything runs in your browser, so the sample and schema you paste stay on your device.
Features
Infers a JSON Schema from a pasted JSON sample with correct types for objects, arrays, strings, numbers, integers, booleans and null
Unifies array elements into one items schema and emits items:{} for empty arrays
Toggle to mark every property as required, per object
Toggle additionalProperties:false to lock objects down to known keys
Optional string-format inference for email, date, date-time, uri and uuid values
Choose draft-07 or 2020-12 output, which sets the $schema dialect
Validate any JSON document against a schema, reporting every error at once with format keyword checks
Copy the generated schema or download it as schema.json
How to use the JSON Schema Generator & Validator
Choose Generate to build a schema, or Validate to check a document.
In Generate, paste a JSON sample and toggle required, additionalProperties and format options.
Pick draft-07 or 2020-12, then copy or download the resulting schema.json.
In Validate, paste a JSON Schema on the left and a JSON document on the right.
Read the valid/invalid badge and the list of errors, each with an instance path.
With required and format inference on, the sample yields a draft-07 schema.
Common errors & troubleshooting
The generated schema has no required array even though every key is present. — Turn on "Mark all properties required"; by default the generator infers types only and leaves required empty so optional fields are not over-constrained.
Validation reports "Invalid JSON Schema" before checking the document. — The schema pane itself must be a valid JSON object that can be compiled; fix the JSON syntax or unknown keywords in the schema first.
A value that looks like a date is typed as a plain string. — Enable "Infer string formats". Detection is conservative and only adds a format when the sample value matches the email, date, date-time, uri or uuid pattern.
A 2020-12 schema is rejected by a validator expecting draft-07. — Switch the draft selector to match your target. It only changes the $schema URL and the minor dialect differences between the two drafts.
Frequently asked questions
Which JSON Schema draft does the generator use?
Draft-07 by default, with an option for 2020-12. The choice sets the $schema dialect URL on the output and the minor differences between the drafts; the inferred structure is otherwise the same.
How are required properties decided when generating a schema?
By default no property is marked required, so the schema accepts partial objects. Turn on "Mark all properties required" to add every key of each object to its required array.
How does the validator report errors?
It reports every failure at once rather than stopping at the first. Each error shows the JSON instance path (such as /items/0/id) and a human-readable message, including missing required keys and unexpected additional properties.
Does the generator infer string formats like email or date?
Yes, when "Infer string formats" is on. It checks sample string values against patterns for email, date, date-time, uri and uuid and adds the matching format keyword; values that match none stay as plain strings.
How does it infer the schema for arrays?
It merges the schemas of all array elements into a single items schema. Mixed object elements are merged property-by-property, a key missing from any element drops out of required, and an empty array becomes items:{}.
Is my JSON sample or schema uploaded anywhere?
No. Generation and validation both run entirely in your browser, so the sample, schema and document you paste are processed locally and stay on your device.
Related tools
JSON Formatter — Beautify, minify and validate JSON with error locations.