Too Much Tools logoToo Much Tools

JSON Schema

Generate a JSON Schema from sample JSON, or validate JSON against a schema, locally.

Local, Runs entirely in your browser, your data never leaves your device.
Loading tool…

Infer a schema from JSON or validate against one

This tool works two ways: paste sample JSON and it infers a draft-07 JSON Schema describing its shape, or paste both a JSON document and a schema and it validates one against the other using Ajv. It's useful for bootstrapping a schema from a real API response, or checking that a payload matches a contract before you ship it. Both modes run locally, so the sample data never leaves your browser.

How to use the JSON Schema

  1. Choose Generate or Validate mode using the toggle above the editors.
  2. In Generate mode, paste sample JSON to infer a draft-07 schema on the right.
  3. In Validate mode, paste JSON data on the left and a schema on the right.
  4. Read the pass or fail result, including one message per failing path.

Schema generation treats every key present in the sample as required, and infers array item types from the first non-undefined element, so an empty array produces an item schema with no constraints. Validation uses Ajv with ajv-formats loaded, so string format keywords like email, date and uri are checked, not just types.

Frequently asked questions

What JSON Schema draft does this generate?
It generates draft-07 schemas, setting the $schema keyword to the draft-07 URL. If your project needs a newer or older draft, you'll need to adjust the $schema value and any incompatible keywords by hand.
Are all fields marked as required in the generated schema?
Yes. Every key that appears in the sample JSON you provide is added to the required array, since the generator has no way to know which fields are actually optional from a single example.
Does the validator check string formats like email or date?
Yes. Ajv is loaded with the ajv-formats plugin, so format keywords such as email, date, date-time and uri in your schema are enforced, not just the basic type keyword.
Is my JSON sent anywhere to generate or validate the schema?
No. Both schema inference and Ajv validation run in your browser; neither the sample data nor the schema you're testing against is uploaded, which matters if the sample includes real records.