JSON to JSON Schema Converter

Infer a JSON Schema document from an example.

Runs in your browser Free · no accountFile upload supported

JSON

JSON Schema

This conversion happens locally in your browser. Your files are never uploaded.

About the JSON to JSON Schema converter

JSON Schema is the portable way to describe the shape of a document — understood by validators in every language, and by OpenAPI, which embeds it directly.

Writing one from scratch for a large payload is slow. Paste an example and get a complete draft 2020-12 schema to edit down.

What is inferred

Object properties with their types, `required` listing every field that was present and non-null, `additionalProperties: false`, and `items` for arrays taken from the first element.

Numbers are split into `integer` and `number` depending on whether the sample had a fractional part.

What to check before using it

`required` is the assumption most likely to be wrong: a field appearing in one sample is not necessarily mandatory. Trim that list to the fields the API genuinely guarantees.

`additionalProperties: false` is strict by design, so a schema that passes today fails the moment the API adds a field. That is often what you want in a test and rarely what you want in production — relax it if you need forward compatibility.

Types come from one sample

Everything here is inferred from the JSON you paste. A field that happens to be absent from your example will be absent from the output, and a field that is null in the sample cannot be typed at all — only marked as nullable.

Paste the richest response you have, then review the optional and nullable fields by hand. Treat the result as a fast first draft rather than a schema.

Frequently asked questions

Which draft does it produce?

Draft 2020-12, the current version and the one OpenAPI 3.1 uses. Most validators accept it, and older drafts differ mainly in keywords this output does not use.

Can I use this in OpenAPI?

Yes. OpenAPI 3.1 schemas are JSON Schema, so the object can be dropped into a components/schemas entry with the $schema line removed.

Is my JSON uploaded?

No. The conversion runs in your browser, which matters when the sample you are pasting is a real API response with real customer data in it.