JSON Schema Generator

Live

JSON Schema Generator creates a JSON Schema from example JSON.

Runs in your browser: what you enter is processed on your device and not uploaded to MyToolDock.

If the top level is an array, its items are treated as several examples of one record, which gives a better schema.

What is JSON Schema Generator?

JSON Schema Generator creates a JSON Schema from example JSON. A schema built from examples describes only what the examples show, so review it before relying on it. It does not guess limits such as minimum or maximum, patterns or enums. Up to 10 MB.

How It Works

  1. Enter a sample JSON document, or an array of several examples in the input fields on this page.
  2. Press the button to run JSON Schema Generator.
  3. Read a JSON Schema (2020-12 or Draft-07) you can copy or download in the result area, and copy or download it.

Common Uses

Good to Know

Give an array of several examples when you can. The tool then knows which keys are optional, which can be null and which hold different types.

In more detail

Paste an example of your JSON and choose the Draft 2020-12 or Draft-07 dialect. The schema appears at once. Options control whether all keys are required and whether extra properties are allowed.

A key is marked required when it is present in every object of an array. Dates, emails, URLs and similar values get a format hint.

Worked example

A sample with nested objects, an array of users, a null value and dates produced a schema, and that schema was checked with the Python jsonschema library. Both drafts accepted the original sample. A sample with a missing required key and one with a wrong type were rejected. In an array of records, a name that was text in two records and null in one became a text-or-null type, and a key missing from one record was left out of the required list.

Limits

A schema made from one example only describes that example. It cannot know about maximum lengths, allowed ranges or optional keys that never appeared. Treat it as a starting point and edit it. Input over 10 MB is not accepted.

Frequently Asked Questions

Can I use it with OpenAPI?

Draft 2020-12 is used by OpenAPI 3.1. For OpenAPI 3.0, Draft-07 is closer, but you may need small changes.

Why are some keys not required?

They were missing from at least one object in the sample.

Is my JSON uploaded?

No. It is processed in your browser.

What does JSON Schema Generator do?

JSON Schema Generator creates a JSON Schema from example JSON. A schema built from examples describes only what the examples show, so review it before relying on it. It does not guess limits such as minimum or maximum, patterns or enums. Up to 10 MB.

What do I need to enter in JSON Schema Generator?

A sample JSON document, or an array of several examples.

Is my data private in JSON Schema Generator?

Your JSON stays in your browser and is not uploaded.

Is MyToolDock JSON Schema Generator free to use?

Yes, MyToolDock JSON Schema Generator is 100% free with no registration, subscriptions, or limits. All features are fully unlocked.

Where can I learn more about JSON Schema Generator and related workflows?

MyToolDock publishes written guides on the topic: CSV to JSON: Simplifying Web Data Imports; Why You Need JSON Formatting and Validation. Each guide links back to the tools it covers.

Related Tools

.env and .properties to JSON Converter INI to JSON Converter JSON Diff JSON Flatten and Unflatten Converter JSON Key Sorter JSON to TypeScript

Guides

More in Developer Tools · Browse all tools

Developer Scratchpad

Copied to clipboard!