Skip to content

JSON to JSON Schema Generator Online

Paste any JSON and instantly generate a JSON Schema (Draft 2020-12) with inferred types, required fields, and string format detection.

Last updated:

What is JSON Schema?

JSON Schema is a declarative language for annotating and validating JSON data. Think of it as a contract: it says "this field must be a string, that one an integer, and these three are required." Common use cases:

  • API validation — validate request and response bodies in Express, FastAPI, or any framework with JSON Schema support.
  • Form generation — libraries like react-jsonschema-form and Formly generate UI forms from a schema.
  • Documentation — OpenAPI (Swagger) uses JSON Schema to describe data models.
  • Config validation — validate CI/CD configs, settings files, and infrastructure-as-code templates.

How this generator works

Paste a JSON example and the tool infers the schema:

  1. Type inference — each value is classified as string, integer, number, boolean, null, object, or array.
  2. Format detection — strings that look like emails, dates, URIs, UUIDs, or IPv4 addresses get a format annotation.
  3. Required fields — by default, all keys at each level are marked required. For arrays of objects, only keys present in every item are required.
  4. Array merging — if your array contains objects with different shapes, the schemas are merged into a single item schema.

The output conforms to JSON Schema Draft 2020-12.

Tips for better schemas

  • Use realistic sample data. The tool infers from what it sees — if a field is always an integer in your sample, it'll be typed as integer.
  • Include edge cases in arrays. Pass multiple objects with different optional fields so the tool correctly marks some as optional.
  • Review and refine. The generated schema is a starting point. Add minLength, pattern, enum, or description fields manually for production use.

Related JSON tools

Frequently Asked Questions

What is JSON Schema?
JSON Schema is a vocabulary that lets you annotate and validate JSON documents. It defines the structure, types, and constraints of your data — used for API validation, form generation, and documentation.
Which JSON Schema draft does this use?
This tool generates schemas conforming to JSON Schema Draft 2020-12, the latest standard. The field is included in the output.
What string formats does it detect?
It automatically infers date-time (ISO 8601), date, email, URI (http/https URLs), UUID, and IPv4 addresses. You can disable format inference with the toggle.
How does it handle arrays of objects?
It merges schemas across all objects in the array. Keys present in every object are marked as required. Keys that appear in only some objects become optional.
Can I use the generated schema for validation?
Yes. The output is a valid JSON Schema you can use with any compliant validator like Ajv (JavaScript), jsonschema (Python), or JSON Schema Validator online.
Is my data safe?
Yes. This tool runs entirely in your browser using JavaScript. Your JSON is never sent to any server.

Related Tools