JSON Schema Generator

Paste a JSON sample and get a draft-07 JSON Schema describing its shape, types, and required fields.


          
        

How it works

The tool walks your parsed JSON recursively. Objects become type: "object" with a properties entry per key and every present key listed in required. Arrays become type: "array" with an items schema built by inferring and merging the type of each element. Primitives map directly: strings, numbers (integers get "integer" instead of "number" when every sampled value is whole), booleans, and null.

This runs through JSON.parse, your browser's native parser, then a small recursive walker, both in this page's own JavaScript. Nothing is uploaded.

Common questions

Which JSON Schema draft does this generate?

Draft-07, the most widely supported version across validators like ajv, jsonschema (Python), and most IDE tooling. The output is plain JSON, so you can hand-edit it afterward if you need a newer draft's keywords.

How are arrays handled?

The tool inspects every item in the array and merges their inferred types. If all items share the same shape, you get one items schema; if types differ across items, it falls back to a broader schema so nothing in your sample is left unrepresented.

Does it mark fields as required?

Yes, every key present in an object is added to that object's required list, since it appeared in your sample. Remove keys from the generated schema's required array if they're actually optional in your real data.