🧑‍💻

JSON Schema Generator

🔒 In your browser

Generate a draft-07 JSON Schema from a sample.

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

Inferred from one sample: every field is marked required. Loosen it by hand for optional fields.

About the JSON Schema Generator

A JSON Schema lets you validate that incoming data has the right shape. Writing one by hand is fiddly, so this free JSON Schema generator infers a draft-07 schema from a JSON sample — with types, properties and required fields — that you can refine and use for validation.

It runs in your browser; your sample data is never uploaded.

How to generate a JSON Schema

  • Paste a representative JSON sample.
  • Get a draft-07 JSON Schema with inferred types and properties.
  • Refine required fields and constraints to suit your validation rules.

What a JSON Schema is for

A JSON Schema formally describes the shape your data should have — which fields exist, their types, and which are required — so you can automatically validate incoming requests or config files before processing them. Writing one by hand is fiddly; generating a draft from a representative sample gives you a correct starting point to refine with your own constraints.

Frequently asked questions

What is a JSON Schema used for?

It defines the expected structure and types of JSON data so you can automatically validate that requests or config files are well-formed before processing them.

Which schema version does it generate?

It generates draft-07 JSON Schema, the most widely supported version across validators and libraries.

Is my sample data private?

Yes. The schema is generated locally in your browser and your data isn't sent anywhere.

Which schema version does it generate?

It generates draft-07 JSON Schema, the most widely supported version across validators and libraries, so the output works with almost any JSON Schema tooling.

Related searches

json schema generatorgenerate json schemajson to schemadraft-07 schemajson schema from samplejson validation schema

Related Developer tools

🔗 Embed this tool on your website — free

Copy this and paste it into your page's HTML. The tool runs in the visitor's browser, just like here. Change height to fit, or add the optional auto-resize snippet below. Add ?theme=dark to the URL for dark mode.

<iframe src="https://toolhq.dev/embed/json-schema-generator/" title="JSON Schema Generator — ToolsHub" width="100%" height="520" style="border:1px solid #e5e7eb;border-radius:12px;max-width:680px" loading="lazy"></iframe>
Optional: auto-resize the iframe height

Add this once on the same page so the iframe grows to fit the tool:

<script>
addEventListener("message", function (e) {
  if (e.data && e.data.type === "toolshub:resize") {
    document.querySelectorAll('iframe[src*="/embed/"]').forEach(function (f) {
      if (f.contentWindow === e.source) f.style.height = e.data.height + "px";
    });
  }
});
</script>