L LocalUse Source

JSON to JSON Schema

Turn a sample document into a JSON Schema. Repeated object shapes are hoisted into $defs and referenced, so the output stays readable even for a large response.

Title
Draft
JSON
Output

Output appears here as you type.

Runs entirely in your browser. Nothing you paste here is uploaded or stored.

Questions

Is my JSON uploaded anywhere?

No. Inference and code generation run entirely in your browser. Nothing is sent to a server, so pasting a real API response with customer data or internal URLs is safe.

Should I paste one object or an array of them?

An array, whenever you have one. Every element is merged into a single shape, so a field that is missing from some records becomes optional and a field that is sometimes null becomes nullable. One object can only ever tell the generator that everything is required.

Should I set additionalProperties to false?

Usually not. It rejects any field that was not in your sample, which means the schema breaks the first time the API adds one. Turn it on only when you genuinely control both ends and want a closed contract.

Which draft should I pick?

Draft 2020-12 unless a tool in your pipeline requires otherwise. It uses $defs; draft-07 uses definitions, and expresses nullable references as an anyOf composition because a $ref cannot carry sibling keywords.

More code generation tools