JSON Schema Generator
Paste a JSON sample — or several — and get a JSON Schema inferred from its shape: types, nested objects, arrays and required keys.
Writing a schema by hand for a payload you already have is busywork with a high typo rate; inferring it from real samples gets the structure right in one pass. The inference rules here are the plain ones, applied recursively. Worked example: the sample {"a": 1, "b": "x", "c": [1, 2], "d": null, "e": 1.5} has 5 properties and produces a schema where a is an integer, b is a string, c is an array whose items are integers, d is null, and e is a number — and all 5 keys are listed as required, because a single sample can only vouch for what it contains. Feed in multiple samples and the picture softens correctly: a key missing from any one sample drops out of required while staying in properties, and a key seen with two different types gets both types listed.
The schema is inferred in this browser from the JSON you paste. Your data is never uploaded, stored or put into a link; it stays in this page on your device only, and closing the page clears it.
Quick answers
How do I generate a JSON Schema from a sample?
Paste the JSON and read the inferred schema. {"a": 1, "b": "x", "c": [1, 2], "d": null, "e": 1.5} yields 5 properties — integer, string, array of integers, null and number — with all 5 keys required.
Paste an array of samples instead and required shrinks to the keys present in every sample, while differing types are merged into a type list.
JSON Schema or Schema.org — which do I need?
JSON Schema describes the shape of data and is used to validate payloads; the Schema Generator (/schema-generator/) builds Schema.org structured data for SEO. This page does the data one.
If your goal is validating an API response or a config file, stay here. If your goal is rich results in search engines, use the Schema Generator.
How to use
- Paste a JSON sample. For a single value, the schema describes exactly that value’s shape.
- To infer from several examples, paste an array of samples with the merge mode selected: properties are combined, and a key is only required if it appears in every sample.
- Read the inferred schema: integers stay integers, decimals become number, nested objects get their own properties and required lists, and arrays describe their merged item type.
- Copy or download the schema and use it with any JSON Schema validator, form generator or API contract test in your own tooling.
About this tool
One distinction worth stating plainly, because the names collide: this tool infers a JSON Schema — a description of the shape of data, used to validate payloads and generate forms. That is a different thing from the Schema Generator (/schema-generator/), which builds Schema.org structured data for SEO — the vocabulary search engines read to understand a web page. JSON Schema validates data; Schema.org describes pages. If you are checking an API response or a config file, you are in the right place; if you want rich results in search, you want the other tool. Inference also has honest limits: it can only describe the samples it saw, so an optional field that happened to appear in every sample will look required — review the result against what you know about the data before treating it as a contract.
Frequently asked questions
How does merging multiple samples work?
Paste an array of samples. Properties are unioned across all samples, a property’s types are combined into a list when they differ (a field seen as both 1 and "s" gets integer and string), and required keeps only the keys present in every single sample.
What is the difference between integer and number?
JSON Schema distinguishes whole numbers from decimals. A sample value of 1 infers integer; 1.5 infers number. If different samples show the same key as both, the merged schema lists both types, so validation accepts either.
Is this the same as the Schema Generator for SEO?
No. This tool infers a JSON Schema that describes the shape of data, for validation. The Schema Generator (/schema-generator/) builds Schema.org structured data that describes a web page for search engines. Similar name, different job — the about section above spells the distinction out.
Is my JSON uploaded to infer the schema?
No. The sample is parsed and the schema is built in this browser. Your data is never uploaded, stored or put into a link, and closing the page clears it.
First time embedding? Read the step-by-step guide →
More free tools
UUID Generator
Generate random v4 UUIDs in bulk.
JSON Formatter & Validator
Format, minify and validate JSON in one click.
What Is My IP
See your public IP address instantly. No sign-up, nothing stored.
Regex Tester
Test, check and validate regular expressions with live highlighting.
JWT Decoder
Decode a JWT token without the secret — see its header and payload.
SHA-256 Hash Generator
Generate SHA-256 / SHA-512 hashes instantly.