JSON to JSON Schema
Infer a JSON Schema from a sample document.
Runs in your browser Runs entirely in your browser. Nothing you put in it ever leaves your device.
Paste JSON, or drop a .json file here. Converts as you type.
Ready. Everything runs in this page.
Was this useful?
About this tool
Turns an example payload into a draft 2020-12 schema you can use for validation. Types are inferred per key, common string formats such as dates, emails and UUIDs are detected, and keys present in every array item are marked required.
How to use it
- Paste a representative JSON document.
- Optionally give the schema a title, and decide whether keys should be required.
- Copy or download the schema.
Supported input
- Any valid JSON value
Privacy
Runs entirely in your browser. Nothing you put in it ever leaves your device. Everything happens in JavaScript on this page, so the tool keeps working even if you go offline after it has loaded — which is the simplest way to see for yourself that nothing is being sent. Read the full privacy information.
Questions
Which draft does it target?
Draft 2020-12, declared through the `$schema` keyword. It is the current draft and is understood by most validators.
How are required keys chosen?
For an array of objects, a key is required only if it appears in every item. Turn the option off if you would rather start from a schema with nothing required.
Is an inferred schema good enough to ship?
Treat it as a first draft. It captures structure and types accurately, but only you know which fields should have length limits, enums or patterns.
Related tools
-
JSON to TypeScript
Generate TypeScript interfaces from a JSON sample.
Stays on your device
-
JSON Formatter
Format, validate and inspect JSON.
Stays on your device
-
JSON to YAML
Convert JSON into readable YAML.
Stays on your device
-
JSON to CSV
Turn JSON into a spreadsheet-ready CSV file.
Stays on your device