JSON Schema generator from sample JSON
JSON Schema is the "user manual" for your JSON: which fields are required, what types they are, what formats they use. Paste a sample JSON here and we will infer the schema for you.
We detect types (string, integer, number, boolean, null, array, object), string formats (email, date-time, uuid, ipv4, uri), homogeneous arrays vs tuples] with prefixItems, and short enums for fields with a limited value set.
Pick a draft (Draft 2020-12, 2019-09, or the older Draft 7) and a strictness mode: strict (additionalProperties: false, everything required) or tolerant (allow extra fields).
How to use it
- Pick the JSON Schema draft at the top (Draft 2020-12 is the safe default).
- Paste a sample JSON in the left panel. The more objects you have in an array, the better we can tell "which fields are required".
- Toggle format detection so that "2026-05-13" gets `"format": "date"` and "user@example.com" gets `"format": "email"`.
- Strict mode forces `additionalProperties: false` and marks every property required. Tolerant mode permits extra keys.
- Copy the generated schema on the right and drop it into your project as a `schema.json` ready for validation.
When this is useful
Real situations when working with APIs and data:
- API documentation - you have a sample response and need a formal schema for OpenAPI or internal docs. Paste JSON, get the schema in 2 seconds.
- Input validation - guarding a POST endpoint against missing required fields. Schema plus an ajv library on the backend = safety.
- TypeScript type generation - JSON Schema feeds tools like `json-schema-to-typescript`. From JSON you get a schema, from a schema an interface.
- Tool configuration - VSCode `settings.json`, ESLint config, package.json all use schemas. You can write your own and get autocomplete in the editor.
- Contract testing - keep last release's schema in source control and validate the new release against it for backwards compatibility.
- Form generation - some libraries (react-jsonschema-form) render forms straight from JSON Schema. Use this tool to bootstrap the schema, then tweak.
To validate JSON against a schema, use our JSON Schema validator. To generate TypeScript types from JSON, see JSON to TypeScript. For exploring data structure, try the JSONPath tester.