JSON Schema Generator

Generate a JSON Schema (draft-07) from sample JSON in your browser. Infers types, required fields, and array item shapes. Free, private.

JSON inputpaste, type, or drop a file
JSON output
Runs 100% in your browser. Nothing is uploaded, logged, or stored, and there are no ads. Verify it yourself: open your browser's Network tab while you convert and watch that no requests leave this page.

About this tool

Paste a representative JSON document and get a draft-07 JSON Schema inferred from it: object properties with required lists, typed scalars (string/integer/number/boolean/null), and array item schemas. Heterogeneous arrays produce anyOf unions of the distinct shapes.

Generated schemas are a starting point (the inference marks every observed field required and cannot know your enums or constraints), but they eliminate the tedious 80% of schema writing.

Common uses

  • Bootstrap request/response validation for an API from real payloads.
  • Generate schemas for VS Code's JSON validation of config files.
  • Document the actual shape of data a third-party service sends you.

Automate via API

The same conversion is available as a REST endpoint for scripts, pipelines, and backends:

curl -X POST https://payloadly.com/api/v1/tools/json-schema-generator \
  -H "Content-Type: text/plain" \
  -H "X-Api-Key: YOUR_API_KEY" \
  --data-binary @input.json

API documentation · Get an API key

Worked examples

Real payloads from tools people use daily, with the exact output this converter produces. Every example runs in your browser, so you can load one and adapt it to your own data.

Generate a schema from a webhook payload

Turn a captured webhook body into a draft-07 schema you can use to validate future deliveries in your own code.

JSON input
{
  "id": "evt_1PabcXYZ",
  "type": "charge.succeeded",
  "created": 1716242622,
  "data": { "object": { "id": "ch_3PabcXYZ", "amount": 2000, "currency": "usd", "paid": true } }
}
JSON output
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "type": {
      "type": "string"
    },
    "created": {
      "type": "integer"
    },
    "data": {
      "type": "object",
      "properties": {
        "object": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "amount": {
              "type": "integer"
            },
            "currency": {
              "type": "string"
            },
            "paid": {
              "type": "boolean"
            }
          },
          "required": [
            "id",
            "amount",
            "currency",
            "paid"
          ]
        }
      },
      "required": [
        "object"
      ]
    }
  },
  "required": [
    "id",
    "type",
    "created",
    "data"
  ]
}

Generate a schema from an API response

Infer a schema from a representative API object, including typed scalars and array item shapes, as a starting point for request/response validation.

JSON input
{
  "id": 701,
  "name": "Grace Hopper",
  "active": true,
  "roles": ["admin", "engineer"],
  "profile": { "email": "grace@example.com", "verified": true }
}
JSON output
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer"
    },
    "name": {
      "type": "string"
    },
    "active": {
      "type": "boolean"
    },
    "roles": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "profile": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string"
        },
        "verified": {
          "type": "boolean"
        }
      },
      "required": [
        "email",
        "verified"
      ]
    }
  },
  "required": [
    "id",
    "name",
    "active",
    "roles",
    "profile"
  ]
}

JSON notes

JSON (JavaScript Object Notation) is the standard interchange format for web APIs, config files, and log pipelines. It is strict: keys must be double-quoted, trailing commas are invalid, and comments are not allowed.

  • JSON does not support comments; they are stripped or rejected by parsers.
  • Trailing commas after the last element are invalid JSON.
  • Integers beyond 2^53 lose precision in JavaScript-based parsers.

Frequently asked questions

Is my data uploaded to a server?

No. This tool runs entirely in your browser using JavaScript, and there are no ads on the page. Nothing you paste or drop here is uploaded, logged, or stored, and you can verify that yourself: open your browser's developer tools and watch the Network tab while you convert (no requests leave the page), or disconnect from the internet after the page loads and keep working.

Why is every field marked required?

The generator sees a single sample and cannot know which fields are optional, so it marks everything it observed as required. Paste a sample with the optional fields absent to compare, or hand-edit the required arrays afterward.

Is there a size limit or a fee?

The browser tool is free with no signup and comfortably handles files up to tens of megabytes (limited by your device's memory). For automated or bulk processing inside your own scripts and pipelines, use the paid REST API.

Related tools