JSON Schema Generator
Paste a sample JSON document and get a first-draft JSON Schema that describes its shape: types, nested objects, lists and required keys. Your sample stays in your browser.
- Free, no strings
- Works on your own device
- 2020-12 or draft 7
- Required keys detected
- Runs on your device. Files are never uploaded.
- Free and unlimited. No sign-up, no watermark.
JSON schema generator in three steps
No account, no email, no waiting for an upload.
- STEP 01
Paste a sample
Use a real document, ideally with several items in any list so optional fields show up.
- STEP 02
Choose the options
Pick 2020-12 or draft 7, decide whether keys found in every sample are marked required, and set the indent.
- STEP 03
Copy the schema
Refine it by hand, then test it with the JSON schema validator.
What JSON schema generator does, and what it doesn't
We'd rather tell you up front than surprise you after the download.
What you get
- Types from valuesStrings, booleans and nulls are typed directly. Whole numbers become integer, other numbers become number.
- Nested structureObjects get properties, and lists get an items schema built from all their elements.
- Required detectionA key present in every object seen at that position is marked required. Keys missing from some list items stay optional.
- Mixed typesA field that is sometimes a string and sometimes null is described with a type list, or anyOf for mixed structures.
- Two schema versionsThe $schema line is written for 2020-12 or draft-07, whichever you pick.
Good to know
- A draft, not a contractOnly what appears in the sample is described. Add minimum, maxLength, enum, pattern and format yourself.
- No additionalProperties ruleThe schema allows extra keys unless you add additionalProperties: false.
- A single object marks all its keys requiredWith one sample there is nothing to compare, so every key counts as required. Turn the option off if that is too strict.
Your data never leave your device
The tool runs inside your browser instead of on our servers, so there is nothing to upload, store or delete afterwards.
Typical online tool upload
Your file travels over the internet, sits on someone else's computer for a while, and you wait for the upload and the download.
Mediaextractr no upload
The tool loads into your browser once, then works on your file locally. Nothing is sent, so nothing can leak.
When people use JSON schema generator
Start an API contract
Turn an example response into a schema, then tighten it.
Validate configs or imports
Create a schema for a settings file and check new files against it.
Learn JSON Schema
See how a document maps to keywords.
Document a payload
Share a schema alongside sample data.
Mediaextractr vs typical upload tools
| MediaextractrPrivate | Typical upload tools | |
|---|---|---|
| Your file is uploaded | Never | Yes |
| Sign-up needed | No | Often, after a few files |
| Daily file limit | None | Often 1–2 free files |
| Watermark | Never | Sometimes |
| Wait for upload & download | No | Yes |
| Speed on very large files | Depends on your device | Depends on their servers |
How inference works
The generator walks the sample and records what it sees at each position. Objects contribute properties. Every element of a list is merged into one items schema, so if some records have an extra field, it appears as an optional property.
It cannot know about rules that do not show up in the data, such as a maximum length or a list of allowed values.
Improve the draft
After generating, spend a few minutes tightening the schema:
- Add format for dates, emails and URIs.
- Add enum for fields with a fixed set of values.
- Set minimum, maximum and minLength where they apply.
- Add additionalProperties: false if unknown keys should be rejected.
- Test it with the JSON schema validator against both good and bad samples, and write types for code with JSON to TypeScript.
A short example: JSON schema generator
For {"id": 7, "name": "Ada", "tags": ["a"]} the schema says the document is an object with id as integer, name as string and tags as an array of strings, and lists all three as required. Add more items to a list sample, one lacking a field, and that field drops out of required automatically.
Questions, answered
How do I generate a JSON Schema from JSON?
Paste a sample document and copy the schema. Then refine it by hand.
Is my sample JSON uploaded when generating a schema?
No. The schema is inferred by script in this tab, so real records stay on your device.
Which schema versions are supported?
2020-12 and draft 7, selected in the options.
How does it decide which fields are required?
Keys that appear in every object at the same position in the sample. Keys missing from some items stay optional.
Does it detect formats like email or date?
No. It only infers types. Add format by hand where needed.
Does the generator run on a phone?
Yes. Paste a sample into a current mobile browser and copy the schema.