⚡
usefultools.dev
{S}

JSON Schema Generator from JSON Sample

NEW

JSON Schema generator that infers draft-07 or 2020-12 schemas from a JSON sample: types, required keys, nested objects and string formats. Free, in-browser.

Runs 100% in your browser — your input is never uploaded or stored on our servers.

A key is required only when it appears in every object of the sample. Mixed values become a type list or anyOf.

⚡

Quick Examples

Typical inputs and the results this tool produces.

Format
{"email":"[email protected]"}
"type":"string","format":"email"
Integer
{"age":31}
"type":"integer", required
Format
{"at":"2026-11-18T09:30:00Z"}
"format":"date-time"
Array
[1, 2.5]
"items":{"type":"number"}
Null
{"n":null}
"type":"null"
📖

Overview

A JSON Schema generator saves you from writing validation schemas by hand. Paste a representative JSON document and get a schema that describes its types, nested objects, array items and required keys, ready for Ajv, OpenAPI components or form generators.

Array items are merged into one item schema, so a key that is missing from some items is left out of "required", and mixed values become a type list such as ["string", "null"] or an anyOf. Whole numbers are typed as integer. Optional format detection adds email, date-time, date, uri and uuid when every sample value matches. You can target draft-07 or 2020-12 and forbid additional properties.

Everything runs in your browser, so sample data is never uploaded.

Why use this tool?

  • Bootstrap a schema in seconds
  • Required keys inferred from real samples
  • Detects email, date-time, uri and uuid
  • Draft-07 or 2020-12 output
  • Private: runs locally
⭐

Features

🏗️

Nested schemas

Objects and arrays are described recursively with properties and items.

✅

Required keys

Keys present in every sample object go into "required".

🏷️

Format detection

Adds format for email, date-time, date, uri and uuid strings.

🔒

Strict mode

Untick "Allow additional properties" to add additionalProperties: false.

📐

Two drafts

Switch the $schema URI between draft-07 and 2020-12.

⬇️

Copy or download

Copy the schema or save it as schema.json.

🛠️

How to Use

1

Paste a JSON sample

Use a realistic document; arrays with several items give better results.

2

Pick the draft

Choose draft-07 or 2020-12 and optionally set a Title.

3

Tune options

Toggle Detect formats, Allow additional properties and Require every key.

4

Copy the schema

Click Copy or Download and review it before using it in production.

🤔

Frequently Asked Questions