Skip to content
AZ Tools

JSON Schema Generator

Paste any JSON and get a draft-07 JSON Schema that matches its shape — types inferred, formats detected, required fields filled in.

JSON Schema (draft-07)
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "user": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer"
        },
        "name": {
          "type": "string"
        },
        "email": {
          "type": "string",
          "format": "email"
        },
        "verified": {
          "type": "boolean"
        },
        "roles": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "address": {
          "type": "object",
          "properties": {
            "street": {
              "type": "string"
            },
            "city": {
              "type": "string"
            }
          },
          "required": [
            "street",
            "city"
          ]
        }
      },
      "required": [
        "id",
        "name",
        "email",
        "verified",
        "roles",
        "address"
      ]
    }
  },
  "required": [
    "user"
  ]
}

How to use

  1. Paste a JSON sample in the input box.
  2. Pick whether all properties should be required (best for strict API contracts) or only the keys that exist (good for partial / patch payloads).
  3. Optionally include the value as examples so generated docs show a sample alongside the type.

About this tool

Show

Walks the JSON you paste, infers types (integer / number / string / boolean / null / array / object), spots common string formats (email, URI, UUID, IPv4, date, date-time), and emits a JSON Schema you can use for validation. Optionally marks every property as required and embeds the value as an examples entry. Two things are inferred from a single document and worth reviewing before you validate against the result: marking every property required over-constrains an API that legitimately omits fields, and the string formats are pattern guesses, so a value that merely looks like a date is annotated as one. Note too that most validators treat format as an annotation unless you switch on strict format checking.

Frequently asked questions

Which draft does it target?

draft-07 — the most widely supported version across validators, code generators, and editor tooling like Stoplight or Redocly. The output is also compatible with the JSON Schema fragment used by OpenAPI 3.0.

How does it handle mixed-type arrays?

If every element produces the same schema, the items is collapsed to that schema. If elements differ, items.type becomes a union (['string', 'integer']). An array of objects gets one merged object schema: every key seen in any element is listed, and only keys present in all elements are required, so the schema still accepts the input it came from. The tool doesn't generate anyOf / oneOf — it stays as simple as possible.

Which string formats are auto-detected?

date-time, date, email, uri, uuid, ipv4. The match must be on the entire string, not a substring.

What about nullable fields?

A null value in the input becomes "type": "null". For optional-nullable fields, run the generator on representative samples and merge — the tool keeps the schema minimal rather than guessing.

Related tools