ToolFeather
Developer / SEORuns in your browser

JSON Schema Generator — from Sample JSON

Generate a JSON Schema (draft 2020-12) from real JSON: types, nested properties, array items, required keys inferred from your samples, and formats such as email, date, uri and uuid.

Quick presets

JSON Schema Generator

JSON
JSON Schema

Runs in your browser — nothing you enter is uploaded or stored.

ToolFeather · JSON → Schema
Scratchpad auto-saved
Stored in this browser (localStorage)
Step-by-step~40s read

How it works — in four simple steps

No signup and nothing to install — it all runs in your browser.

1

Add your JSON

Paste it into the left box, press Open file, or drag a .json file onto it. Sample loads a realistic example.

2

Set the options

Adjust the options above the boxes — the output updates instantly as you change them.

3

Check the result

Read the status line: it reports rows, keys and any value that couldn't be represented in JSON Schema.

4

Copy or download

Copy the JSON Schema or download it as a .json file. Nothing was uploaded at any point.

Pro tip

Paste several records — required keys are those present in every one of them.

Features

Required keys inferred

A key is marked required only if it appears in every object you pasted — or force every key to be required.

Strict mode

Add additionalProperties: false to reject unexpected keys during validation.

Example values

Optionally add an examples array to each simple field, taken from the first real value in your data.

Private by design

Parsing and conversion run in your browser with JavaScript — your data is never uploaded, logged or stored.

About the JSON Schema Generator

A JSON Schema describes what valid JSON looks like, and it's used everywhere: request validation in APIs (OpenAPI 3.1 uses JSON Schema 2020-12 directly), form generation, config-file validation in editors like VS Code, and data contracts between teams. Writing one from scratch is tedious; inferring it from a sample gets you 90% of the way in a second.

The generator merges every value it sees at each position. A property's type is the set of JSON types observed (integer and number merge to number; a sometimes-null field gets ["string", "null"]). For arrays of objects, a key is listed in required only if it appears in every object, which is the main reason to paste several records. Strings whose values all look like an email, a URI, a UUID, an IPv4 address, a date or a date-time get the matching format.

Options let you mark every key required, forbid unknown keys with additionalProperties: false, add a title, and include an examples value for each simple field taken from your data. The output declares "$schema": "https://json-schema.org/draft/2020-12/schema".

Examples

Three sign-up records: one lacks a phone number, one has a null referrer, and the strings include emails, dates and a URL.

JSON input
[
  { "id": "3f1c9a2e-8b7d-4c1e-9f2a-1b2c3d4e5f60", "email": "ada@example.com", "signedUp": "2026-10-19", "plan": "pro", "seats": 5, "referrer": "https://news.example.com" },
  { "id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d", "email": "alan@example.com", "signedUp": "2026-10-20", "plan": "free", "seats": 1, "referrer": null, "phone": "+447700900123" },
  { "id": "0f1e2d3c-4b5a-4968-8776-655443322110", "email": "grace@example.com", "signedUp": "2026-10-21", "plan": "team", "seats": 12.5, "referrer": "https://blog.example.org/post" }
]
JSON Schema output
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Signup",
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "format": "uuid"
      },
      "email": {
        "type": "string",
        "format": "email"
      },
      "signedUp": {
        "type": "string",
        "format": "date"
      },
      "plan": {
        "type": "string"
      },
      "seats": {
        "type": "number"
      },
      "referrer": {
        "type": [
          "string",
          "null"
        ],
        "format": "uri"
      },
      "phone": {
        "type": "string"
      }
    },
    "required": [
      "id",
      "email",
      "signedUp",
      "plan",
      "seats",
      "referrer"
    ]
  }
}

This output was produced by the converter on this page with title “Signup” — load it with the “Sign-ups” preset above and change any option to see the effect.

How JSON maps to JSON Schema

In JSONBecomes in JSON Schema
"age": 36{"type": "integer"}
Ints and floats mixed{"type": "number"}
Sometimes null{"type": ["string", "null"]}
Key present in every objectlisted in required
"ada@example.com""format": "email"
"2026-10-21""format": "date"
Array{"type": "array", "items": {…}}

Things that trip people up

JSON vs JSON Schema at a glance

PropertyJSONJSON Schema
SpecificationRFC 8259 (2017) · ECMA-404JSON Schema 2020-12
File extension.json.json
Media typeapplication/jsonapplication/schema+json
Data typesstring, number, boolean, null, object, arraytype, properties, items, required, format
CommentsNo$comment
NestingUnlimitedUnlimited

Frequently asked questions

5 answers
How do I generate a JSON Schema from JSON?
Paste one or more sample JSON documents (an array of examples works best) and copy the schema. Types, nested properties, required keys and formats are inferred.
Which draft does it produce?
JSON Schema draft 2020-12, the version used by OpenAPI 3.1.
How are required fields decided?
A key is required if it appears in every object at that position in your sample. Tick Every key required to require all keys instead.
Can I validate JSON against the schema?
Yes, with any 2020-12 validator such as Ajv (JavaScript), jsonschema (Python) or the JSON Schema support built into VS Code.
Is my data uploaded anywhere?
No. The JSON is parsed and converted by JavaScript in your browser tab; nothing is sent to a server, so it is safe for internal exports, customer lists and configuration files with secrets.