Generate JSON Schema draft-07 from a JSON sample. Handles nested objects, arrays, and required fields. Client-side only.
JSON Input
JSON Schema Output (draft-07)
Pro tip
Missing API request validation in PRs? Git AutoReview flags unvalidated inputs and missing schema definitions before they reach production.
Paste a JSON sample into the left panel and a JSON Schema draft-07 document generates automatically. The schema captures object properties and their types, required fields, nested objects, and array item schemas. Press Ctrl+Enter to regenerate, Ctrl+Shift+C to copy the output.
Values map to JSON Schema types: strings to "type": "string", integers (via Number.isInteger) to "type": "integer", decimals to "type": "number". Nested objects recurse into "type": "object". Every key in the sample ends up in the required array — trim that before shipping.
The fastest path in Node.js is ajv: call ajv.compile(schema) once at startup, then validate(data) against each document you want to check. In Python the jsonschema package does the same job with a similar API. Postman accepts the schema in test scripts for response validation. In VS Code, dropping a $schema property into a JSON file gives you inline validation and autocomplete as you edit.
Draft-07 hits the widest compatibility across the ecosystem — ajv, Postman, OpenAPI 3.0, most code generators, and database schema tools all target it. Draft 2019-09 and 2020-12 add useful features but tool support is genuinely still catching up. For schemas that need to work across multiple libraries or platforms without configuration headaches, draft-07 is the practical choice.
Treat the output as scaffolding. One sample misses nullable variants, absent-in-some-responses fields, and format constraints like email or date-time. The required array marks everything from your sample as required — trim it to match what your API actually requires.
Press Ctrl+Enter to generate the schema. Press Ctrl+Shift+C to copy the output.
We built the schema generator because hand-written validation code is the thing that gets skipped when deadlines hit and then silently wrong for months. JSON Schema gives you a version-controlled document that describes the shape of valid data: required fields, types, constraints. Any validator library can check an incoming document against it in milliseconds and give you a precise error list rather than a runtime crash at 3am.
Draft-07 is the safe default — ajv, Postman, OpenAPI 3.0, and most code generators all target it. Draft 2019-09 and 2020-12 add things like unevaluatedProperties and prefixItems for arrays, but tool support is genuinely still catching up across the ecosystem. Unless you specifically need those newer features, draft-07 gives you the widest compatibility with the least friction.
In Node.js, compile the schema once with ajv and call validate(data) for each document. In Python the jsonschema package does the same job. Postman accepts JSON Schema directly in test scripts for response validation. If you are using OpenAPI 3.0, request and response body definitions are JSON Schema. VS Code also reads a $schema property in JSON files and validates inline as you edit.
The required array tells validators which fields must be present for a document to pass. This tool marks every key from your sample as required because every key was present in it — which is usually too strict. Go through the list and remove anything your API sometimes omits. Required being over-inclusive is one of the most common reasons valid payloads start failing validation in production.
Here is what every schema generator gets wrong about its own output: it marks every field in your sample as required, which is almost never correct in real APIs. The sample you pasted probably had a good day — all fields present, no nulls. Your production API has bad days. Review required and nullable before you ship.
ajv is the most downloaded JSON validator on npm and targets it directly. Postman uses it for request and response validation in test scripts. OpenAPI/Swagger uses JSON Schema for body definitions. VS Code reads $schema properties for inline JSON validation. Kubernetes CRD validation, Pydantic v2 in Python, and most GraphQL code generators all speak the same format.
Ctrl+Enter (Cmd+Enter on Mac) to generate the schema, Ctrl+Shift+C to copy the output.
Developer Toolkit by Git AutoReview
Free tools for developers. AI code review for teams.