JSON Schema generator
Create a working JSON Schema 2020-12 from a sample with an explicit additional-object-members policy.
Enter data
A JSON sample and additional-object-members policy. Fields marked with an asterisk are required.
About this tool
An API sample can accelerate schema drafting but does not define a complete contract. This generator describes observed types and required members, using anyOf for differing array elements. Additional members are allowed by default; closing objects requires your choice. It does not establish future data or business-rule compliance.
How to use the calculator
- Paste a representative anonymized JSON sample.
- Choose whether all objects should allow additional members.
- Select “Process”, review required, items and anyOf, then test the schema with your own validator.
Calculation details
Formula and calculation method
Primitives produce type; numbers always infer number. Objects produce properties and required for observed names. Arrays produce items with an element schema or anyOf for differing shapes. Empty arrays use items: {}.
Worked example
For {"city":"Łódź","active":true}, the schema has type: object, city as string, active as boolean, both names in required and additionalProperties: true by default. The city name is not inferred as an enum.
Limitations
- JSON: up to 50,000 UTF-16 units and 10,000 values. These tools cap nesting at 32 container levels and output at 500,000 units. Duplicate names and unpaired Unicode surrogates are rejected. These are project limits.
- Up to 64 schema shapes per array. Different objects remain separate anyOf alternatives, not one merged object with optional members. Empty objects allow members when open and no members when closed.
- Draft 2020-12 only. No $ref, schema fetching, enums, date/email formats, ranges, patterns or automatic validation. All numbers infer number, including integers. Review and refine the contract.
Sources
- JSON Schema 2020-12 — Core
- JSON Schema 2020-12 — Validation
- IETF RFC 8259 — JSON syntax and interoperability
Engine version: 1.0.0 · Last reviewed: 2 October 2026
Frequently asked questions
Is the generator a JSON Schema validator?
No. It creates a working document from a sample. Schema validation and checking data are separate tasks.
Are observed members required?
Yes. required includes every member of each sampled object. Check this against the API contract before use.
Do dates or emails get a format?
No. They remain string. Text meanings and domain rules are not guessed.
Is content uploaded or saved?
Input and output are not submitted to a server or analytics or saved in form history or the URL. Copying is a separate action. Reset cannot remove earlier copies, printouts or extension data. Do not paste secrets.