AnyTool
Your files never leave your device. All processing happens locally in your browser.

How do I generate a JSON Schema from sample JSON?

Paste a sample JSON document and AnyTool infers a JSON Schema in real time — detecting types, nested objects, required fields, enums, and formats. Switch instantly between Draft-04, 06, 07, 2019-09, and 2020-12. Everything runs in your browser, so your sample data never leaves the page.

  • Live schema inference as you type
  • All drafts: 04, 06, 07, 2019-09, 2020-12
  • Infers types, required fields, enums, and formats
  • Handles nested objects and arrays of mixed records
  • 100% in-browser — your JSON is never uploaded

What is

JSON Schema

JSON Schema is a vocabulary for describing and validating the structure of JSON data — its types, required properties, formats, and constraints. A generator infers a schema automatically from a sample JSON document.

Developer Tools

Related terms

JSONValidationDraft 2020-12AjvSchema Inference

How to Generate a JSON Schema

Infer a JSON Schema from sample JSON in your browser.

20 secWeb browser
  1. 1

    Paste sample JSON

    Paste or drop a representative JSON document — it is parsed locally.

  2. 2

    Pick a draft

    Choose Draft-04 through 2020-12; the schema re-renders live.

  3. 3

    Copy schema

    Copy or download the generated JSON Schema — nothing is uploaded.

Result: A JSON Schema document

Frequently Asked Questions

No — inference runs entirely in your browser, fully offline.

Your sample JSON never leaves the page. Inference runs locally (and off the main thread for large inputs), unlike server-side converters that warn your data may be stored on their servers.

All major drafts: 04, 06, 07, 2019-09, and 2020-12, switchable instantly.

Most generators lock to a single draft; this one covers the full range (04 through 2020-12) with a one-click switcher that re-renders the schema using the right keywords ($defs vs definitions, $id vs id) for each draft.

Yes — it detects required properties, enums, and formats like date-time and email.

Beyond types, it infers required fields, low-cardinality enums, and string formats (date-time, email, uri, uuid), and merges arrays of varied objects into a superset schema rather than just the first item.

Detailed Explanation

Methodology

How the JSON Schema Generator Works

AnyTool infers a JSON Schema from a sample document by walking the parsed JSON to detect types, nested objects, arrays of mixed records (merged into a superset rather than just the first item), null handling, and required fields. An opt-in heuristic pass detects enums (low-cardinality string sets) and string formats (date-time, email, uri, uuid). A draft adapter re-renders the output for Draft-04, 06, 07, 2019-09, or 2020-12, mapping keywords like $defs/definitions and $id/id correctly. Generation is debounced and runs live as you type.

  • Type, required, and nested-structure inference
  • Arrays of varied objects merged into a superset schema
  • Opt-in enum and format (date-time/email/uri/uuid) detection
  • All drafts: 04, 06, 07, 2019-09, 2020-12 via a draft adapter
  • Debounced live generation; copy or download the schema
Privacy & Security

Privacy vs Server-Side Converters

Liquid Technologies warns that submitted data is stored on its servers, and CodeBeautify's URL-load implies a server fetch. AnyTool infers the schema entirely in the browser (off the main thread for large inputs), so your sample JSON never leaves the page and the tool works offline.

JSON Schema Generator: AnyTool vs typical tools
CapabilityAnyToolTypical tools
GenerationIn your browserSometimes server-side
Draft coverage04 to 2020-12Often single draft
Enum / format inferenceYes (opt-in)Varies
Array-of-objects mergeSuperset schemaOften first item only
Works offlineYesNo

Capabilities reflect the live AnyTool tool; competitor behavior varies by service.