JSON Schema Generator
Infer a JSON Schema (draft-07) from a sample JSON document, giving you a starting schema for validation and documentation.
About this tool
Infer a JSON Schema (draft-07) from a sample JSON document, giving you a starting schema for validation and documentation.
Example
Input: {"age":30}
Output: {"type":"object","properties":{"age":{"type":"integer"}}...}
Privacy
This tool runs entirely in your browser. Your data is processed locally and never uploaded to a server.
How to use this tool
- Paste a sample JSON document into the input box.
- Run the generator to create an inferred JSON Schema draft-07.
- Review the required fields, types, and nested objects in the generated schema.
- Edit the schema by hand if you need stricter rules than the sample can show.
Step by step, what happens
- The tool reads your sample JSON and inspects its structure, field names, and value types.
- It builds a draft-07 schema that matches what it sees, including objects, arrays, strings, numbers, booleans, and nulls.
- If the sample contains repeated array items or nested objects, it infers those shapes into the schema as well as it can from the example.
- The output gives you a starting schema that you can use for validation or as documentation, then refine manually for edge cases.
Worked example
Suppose you have a sample user record and want a starter schema for validation.
Input: {"id":1,"name":"Ava","active":true,"tags":["admin","beta"]}
- You paste the sample user object into the JSON Schema Generator.
- The tool detects an object with four properties and infers their types from the sample values.
- It treats tags as an array of strings because the sample array contains string items.
- It returns a draft-07 schema with properties for id, name, active, and tags.
Output: {"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"active":{"type":"boolean"},"tags":{"type":"array","items":{"type":"string"}}},"required":["id","name","active","tags"]}
Tips and common mistakes
- Use a representative sample, because the tool can only infer from what you paste in.
- If a field can be missing in real data, remove it from required after generation if the sample made it look mandatory.
- Arrays are inferred from the items in the sample, so mixed item types may need manual cleanup.
- A single example cannot capture every constraint, so expect to tighten formats, enums, and number limits by hand.
Frequently asked questions
Which draft is generated?
JSON Schema draft-07, the most widely supported version.
Is the schema final?
It is a strong starting point inferred from your sample; refine constraints (formats, enums) as needed.
Is it private?
Yes, generation runs in your browser.
More Developer Tools Tools
Explore related calculators in this category
.htaccess Generator
Generate common .htaccess rules, force HTTPS, www redirect, and caching, with checkboxes.
API Key Generator
Generate random, secure API keys and tokens with an optional prefix. Cryptographically secure.
Bcrypt Hash Generator
Generate bcrypt password hashes in your browser with a configurable cost factor. Free online bcrypt tool.
CSRF Token Generator
Generate cryptographically secure random CSRF tokens for forms and APIs.
You Might Also Like
Popular tools from other categories
Barcode Generator
Generate Code 128 / EAN barcodes from your data.
Color Palette Generator
Generate a harmonious color palette from one base color.
Generator Sizing Calculator
Estimate generator kW needed for your loads.
Hashtag Generator
Generate relevant hashtags from a topic keyword.
Can't Find the Right Calculator?
Try our AI Math Solver, type any problem in plain English and get instant step-by-step solutions.