JSON Schema generator
Infer a JSON Schema, Draft-07 compatible, from sample JSON data, entirely in your browser.
Generated schema
Schema generated
- Properties defined
- -
- Top-level keys
- -
How it works
JSON Schema is a vocabulary for describing and validating the shape of JSON data. This tool inspects a sample object or array, infers a type and format for every value, and builds a Draft-07 compatible schema you can drop straight into a validation library.
- Paste representative sample JSON
Include every field you expect, with realistic example values.
- Choose required, examples and extra properties
The schema updates as you change any option.
- Copy or download the schema
Review the required array and formats before using it in production.
What the generator detects
Every value is typed as string, integer, number, boolean, array, object or null. String values are additionally checked against common formats: email, date, date-time, uri, uuid and ipv4, in that order, so a value matching more than one pattern gets the first match. Arrays with items that share the same inferred type collapse into a single items schema; arrays that mix types use oneOf, with the examples merged rather than repeated.
A schema is only as good as its sample
The generator can only infer what it sees. If a field is sometimes null and sometimes a string, but your sample only shows the string case, the schema specifies string and misses the nullable case. Use a sample that covers every value type, optional field and edge case you expect in real data.
Frequently asked questions
How do I automatically generate a JSON Schema from sample JSON data?
Paste a representative JSON object or array into the input area. The tool inspects each key and value, infers the type (string, number, boolean, array, object, or null), and generates a Draft-07 compatible JSON Schema as you type. You can optionally add a schema title and choose whether to require object keys, include example values and allow extra properties.
Is the generated JSON Schema sent to a server?
No. Schema generation runs entirely in your browser using JavaScript. Your JSON data and the resulting schema stay on your device. You can safely use production data, internal API payloads, or confidential configuration objects as the source without any server-side exposure.
What is JSON Schema used for and why would a developer need it?
JSON Schema is a vocabulary for describing and validating JSON data structures. Developers use it to validate API request and response bodies, generate documentation, configure code generators like quicktype or openapi-generator, enforce data contracts between services, and set up form validation in frameworks that support schema-driven forms.
What is a key limitation of inferring JSON Schema from a single sample?
The generator can only infer what it sees in the provided sample. If a field is sometimes null and sometimes a string, but your sample only shows the string case, the schema will specify string type and miss the nullable case. Always use a representative sample that covers all expected value types, optional fields, and edge cases to produce an accurate schema.
Can I use the generated JSON Schema to validate data in my code?
Yes. The generated schema is standard JSON Schema Draft-07, supported by popular validation libraries such as Ajv for JavaScript and Node.js, jsonschema for Python, and JSON.NET Schema for .NET. Copy the schema output and integrate it with your validation library of choice. Review and adjust the required array and type constraints before using it in production.
Should I allow extra properties that are not in my sample?
By default the schema sets additionalProperties to false, so a validator rejects any field not in your sample, useful for catching typos and unexpected data. Turn on "Allow extra properties not listed here" if the real data legitimately has optional fields your sample did not happen to include, such as a flexible API response.