JSON Schema Generator

Paste example JSON and get a JSON Schema that describes it, ready to validate API data or forms.

FreeNo sign-upPrivate — runs in your browser
0Properties
0Depth
0Lines

How to use the JSON Schema Generator

  1. Paste sample JSONUse a real example of the data, such as an API response. The more complete the example, the better the schema.
  2. Choose the optionsPick the draft, whether keys are required, whether to detect formats like email and date-time, and whether extra properties are allowed.
  3. Copy or downloadUse the schema with a validator such as Ajv, in OpenAPI docs, or to check form data.

Example

"email": "asha@example.com" becomes {"type": "string", "format": "email"}, and "balance": 250.75 becomes {"type": "number"}.

In the sample, coupon is null in one order and a string in the other, so its type is ["null", "string"]. The schema has 18 properties in total.

Frequently asked questions

How are arrays handled?

All items in an array are combined into one “items” schema. Keys that appear in every object item are required; keys that appear only in some are optional.

Which formats are detected?

date-time, date, time, email, uuid, uri (http and https links) and ipv4. A format is only added when every example value matches it. Turn off “Detect formats” if you do not want them.

Which draft should I choose?

2020-12 is the latest and is used by OpenAPI 3.1. Draft-07 is the most widely supported by older validators and tools. The generated keywords work in both.

Popular posts from this blog

Character Counter

Speech to Text Online

Keyboard Tester