Skip to main content
L
Loopaloo
Buy Us a Coffee
All ToolsImage ProcessingAudio ProcessingVideo ProcessingDocument & TextPDF ToolsCSV & Data AnalysisConverters & EncodersWeb ToolsMath & ScienceGames
Guides & BlogAboutContact
Buy Us a Coffee
L
Loopaloo

Free online tools for developers, designers, and content creators. Your files are processed in your browser and are never uploaded - no accounts required. A few network utilities (like What's My IP and Currency Converter) call public APIs to do their job and say so on their pages.

support@loopaloo.com

Tool Categories

  • Image Tools
  • Audio Tools
  • Video Tools
  • Document & Text
  • PDF Tools
  • CSV & Data
  • Converters
  • Web Tools
  • Math & Science
  • Games

Company

  • About Us
  • Contact
  • Blog
  • FAQ

Legal

  • Privacy Policy
  • Terms of Service
  • Disclaimer

Support

Buy Us a Coffee

© 2026 Loopaloo. All rights reserved. Built with privacy in mind.

Privacy|Terms|Disclaimer
  1. Home
  2. Document & Text
  3. JSON Schema Generator
Add to favorites

JSON Schema Generator

Generate a JSON Schema (draft 2020-12 or draft-07) from a JSON document as you paste, with detected formats and a check that your document validates.

Text processed locallyMore document & textJump to full guide

Initializing in your browser…

You might also like

JSON Formatter & Validator

Format, validate and minify JSON, JSONC or JSON5 as you paste, with exact numbers, precise error locations, a tree view, JSONPath queries and schema checks.

Haiku Generator

Generate 5-7-5 haiku from nine themes or your own words, with every syllable counted from a pronouncing dictionary, plus line shuffles, saving and image export.

Markdown Table Generator

Build Markdown tables in an editable grid or paste them from a spreadsheet or CSV, with column alignment, escaped pipes and neatly padded output.

JSON Schema Generator: a worked example

You are adding validation to an order webhook and want a schema that matches the payloads your shop already sends.

Sample payload

{
  "orderId": 12345678901234567890,
  "customer": { "email": "ada@example.com", "since": "2024-01-15T10:30:00Z" },
  "lines": [
    { "sku": "A-1", "qty": 2, "note": "gift wrap" },
    { "sku": "B-7", "qty": 1 }
  ]
}
What JSON Schema Generator produces

Generated schema (draft 2020-12, shortened)

"orderId":  { "type": "integer" }
"customer": { "type": "object",
              "properties": {
                "email": { "type": "string", "format": "email" },
                "since": { "type": "string", "format": "date-time" } },
              "required": ["email", "since"] }
"lines":    { "type": "array",
              "items": { "type": "object",
                         "properties": { "sku": string, "qty": integer, "note": string },
                         "required": ["sku", "qty"] } }

Checked: your document validates against this schema.

The 20-digit order ID is typed as an integer because the number is read exactly, not as a rounded double. Both order lines are combined into one items schema, so note is optional: it appears in the first line but not the second. The email and timestamp strings match their formats, so format annotations are added. Finally the payload is validated against the schema it produced and passes, which is the minimum a generated schema must do before you use it.

About the JSON Schema Generator

Paste a JSON document and get a JSON Schema for it instantly, in draft 2020-12 or draft-07, with types, required properties, nested objects, arrays and detected formats such as email and date-time. The tool then validates your document against the new schema and shows the result.

How it works

A JSON Schema describes the shape of JSON data: which properties exist, what type each one has, which are required and what format strings follow. Schemas are used to validate API requests and responses, describe OpenAPI endpoints, check configuration files, power editor autocompletion in VS Code and generate forms and types. Writing one by hand for a large document is slow and error-prone, so this generator writes a first version from an example document, which you then refine.

What it infers. Every value becomes a type: string, integer, number, boolean, null, object or array. Whole numbers become integer, and a property that is sometimes an integer and sometimes a decimal becomes number. Objects get properties, a required list and additionalProperties. Arrays get an items schema built from every element rather than only the first, so if one order line has a note and another does not, note is listed as optional. Properties that are sometimes null get a type that allows null. With format detection on, strings that are all valid emails, URIs, UUIDs, IP addresses, dates, times or date-times get the matching format; dates are checked against the calendar, so 2024-02-30 is not called a date.

Honest about what one example can prove. A single document cannot tell you everything about future data, so the defaults make only claims the document supports: a property is required only if it appears in every sample of its object. Options let you go further when you know more. You can refuse unknown properties (additionalProperties: false), turn small sets of repeated strings into an enum, add minimum and maximum, minLength and maxLength taken from the sample, include example values or placeholder descriptions. The notes explain the consequences, for example that bounds describe this sample rather than all valid data.

Checked before you use it. After generating the schema, the tool validates your original document against it with its own checker and tells you whether it passes. If an option makes the schema reject its own source, such as marking every property required when some only appear sometimes, the failing paths are listed. Numbers are read without converting them to floating point, so a 20-digit ID is described correctly as an integer and any example values are written exactly as they appear.

Drafts and privacy. Choose draft 2020-12, the current version used by OpenAPI 3.1, or draft-07, which older validators and tools still expect. Copy the schema or download it as schema.json. Everything runs in your browser, so production payloads and configuration files are never uploaded.

How to use

  1. 1Paste a JSON document, open a .json file, or press Try an example.
  2. 2Choose the draft (2020-12 or draft-07) and how required properties are decided.
  3. 3Read the generated schema on the right; it updates as you type.
  4. 4Check the line under the schema confirming that your document validates against it.
  5. 5Open More options to add enums, bounds, string lengths, examples, descriptions or to refuse unknown properties.
  6. 6Copy the schema or download it as schema.json.

Key features

  • Instant schema generation as you paste or type
  • JSON Schema draft 2020-12 and draft-07
  • Types for nested objects and arrays, built from every array element
  • Required properties inferred from what appears in every sample
  • Nullable properties detected
  • Format detection for email, URI, UUID, IP addresses, date, time and date-time
  • Optional enums, numeric bounds, string lengths, examples and descriptions
  • Optional additionalProperties: false for strict schemas
  • Self-check that validates your document against the generated schema
  • Exact handling of large numbers; runs locally in your browser

When to reach for this

  • Documenting an API

    Generate a schema from a real response and use it as the starting point for an OpenAPI component or API documentation.

  • Validating requests and webhooks

    Create a schema from a sample payload and plug it into a validator such as Ajv to reject malformed input in your service.

  • Editor autocompletion for config files

    Write a schema for a JSON configuration format and reference it so VS Code offers completion and warnings while editing.

  • Generating types and forms

    Feed the schema to tools that generate TypeScript types, database models or form UIs.

Tips & best practices

  • Paste a document with several array elements; the more variety in the sample, the more accurate the optional and nullable properties.
  • Leave additionalProperties open for APIs that may add fields later, and close it for configuration files where a typo should be caught.
  • Check enums by hand; a value that did not appear in the sample will be rejected.
  • After editing the schema, validate other documents with the JSON Formatter's schema check.

Examples

  • An optional property in an array

    Order lines {"sku": "A-1", "qty": 2, "note": "gift wrap"} and {"sku": "B-7", "qty": 1} produce an items schema with sku and qty required and note optional, because note appears in only one of the two lines.

  • Detected formats

    A customer with "email": "ada@example.com" and "since": "2024-01-15T10:30:00Z" gets "format": "email" and "format": "date-time", since every sample of each property matches.

  • A strict schema

    With "Refuse properties the document did not show" on, every object gets "additionalProperties": false, so a payload that adds an unexpected field fails validation.

Frequently asked questions

Which draft should I choose?

Use draft 2020-12 for new work, OpenAPI 3.1 and up-to-date validators such as recent versions of Ajv. Choose draft-07 if your validator, framework or editor only supports older drafts, which is still common.

How are required properties decided?

By default a property is required only if it appears in every sample of that object, for example in every element of an array. You can also mark every property required, which can make the schema reject its own source, or mark none.

Is a generated schema ready for production?

Treat it as a strong first draft. One example cannot show every valid value, so review the types, required list and formats, and loosen or tighten them to match your real rules. The self-check confirms only that the example itself passes.

Does a format make validation stricter?

Not by default. In both drafts, format is an annotation unless the validator is configured to assert formats, as Ajv does with the ajv-formats package. It documents intent and helps tools, but many validators do not enforce it.

What happens with very large numbers?

The document is read without converting numbers to floating point, so a 20-digit identifier is typed as integer and, if you include examples or bounds, written with every digit intact.

Is my JSON uploaded?

No. Parsing, inference and validation all happen in your browser.

Related tools and how they differ

  • JSON Formatter & Validator: Formats JSON and validates documents against a JSON Schema.
  • Mock Data Generator: Creates realistic sample JSON data when you need test documents.
  • YAML Formatter & Converter: Converts YAML configuration to JSON so you can generate a schema for it.

Private by design

Your text is processed locally in the browser. Nothing you paste or open is transmitted or logged.