One document, or several samples as JSON Lines.
Options for JSON Schema

No options for JSON Schema; the name above is the root type.

Generate a JSON Schema from JSON

Paste a JSON sample and get a draft 2020-12 JSON Schema: object properties with required for the keys every record has, integer vs number, arrays with their item schema, [type, "null"] where null appears and anyOf for mixed values. The sample validates against the schema in the tests.

Use it as a starting point for an API contract or a config file's schema; it runs entirely in your browser.

Need a different language? See all JSON-to-code converters.

JSON to JSON Schema Generator — frequently asked questions

Which JSON Schema draft is used?
Draft 2020-12, declared in $schema. The schema sets additionalProperties to false on every object, which you can remove where extra keys are fine.
What if some records have fields that others don't?
Every item of every array and every sample is read, not just the first. A field missing from some records comes out optional, a field holding two kinds of value becomes a union (or the language's any-value type), null beside a value makes it nullable, and a list of records at the top level gets an item type plus an alias for the list. Paste several samples as JSON Lines, one per line, and they're merged the same way.
Is my JSON uploaded anywhere?
No. Parsing and code generation run entirely in your browser with JavaScript — your JSON never leaves your device, so it's safe to paste API responses and other sensitive payloads. It's free with no sign-up.

Spotted a bug or have a suggestion?

Found something broken, have an idea, or just want to say thanks about any of our tools? Every message reaches a real person.