JSON Schema Generator
Software · 1 inputs · Free
JSON Schema Generator
Parameters
What is this tool?
JSON Schema Generator helps developers with encoding, encryption and text processing. Infers a JSON Schema (draft 2020-12) from a sample JSON document: types, properties, required for keys present in every sample, a merged schema for array items (anyOf for mixed types), integer vs. number, and null. A string only gets a format when it matches strictly: date-time, date, email, uri or uuid.
📘 Common mistakes · Worked exampleInfers a JSON Schema (draft 2020-12) from a sample JSON document: types, properties, required for keys present in every sample, a merged schema for array items (anyOf for mixed types), integer vs. number, and null. A string only gets a format when it matches strictly: date-time, date, email, uri or uuid.
The result is not exact or binding and is for information only; it is not an official document and cannot be used in official procedures. Confirm it with the competent authority or a professional before acting; no liability is accepted for losses arising from its use.
Last reviewed: · Methodology and sources
How is it calculated?
Infers a JSON Schema (draft 2020-12) from a sample JSON document: types, properties, required for keys present in every sample, a merged schema for array items (anyOf for mixed types), integer vs. number, and null. A string only gets a format when it matches strictly: date-time, date, email, uri or uuid.
Inputs
| Value | Unit | Example |
|---|---|---|
| JSON | — | {"id":1,"user_name":"Ada","email":"ada@example.com","score":9.5,"active":true,"tags":["a","b"],"address":{"city":"Berlin","zip":null},"orders":[{"order_id":7,"paid":true},{"order_id":8,"note":"gift"}]} |
What is this tool?
JSON Schema Generator helps developers with encoding, encryption and text processing. Infers a JSON Schema (draft 2020-12) from a sample JSON document: types, properties, required for keys present in every sample, a merged schema for array items (anyOf for mixed types), integer vs. number, and null. A string only gets a format when it matches strictly: date-time, date, email, uri or uuid.
Common mistakes
- Mistaking the generated schema for the contract. It is the common shape of the records in the sample; it cannot know cases the sample lacks (a missing field, a null, another type) and can turn out stricter or looser than intended.
- Confusing required with "cannot be null". required only demands that the key exists; whether the value may be null is decided by type. Optional but non-null fields and required but nullable fields are both valid.
- Assuming a format line validates on its own. In draft 2020-12 format is an annotation by default; if you want formats checked, enable that in your validator.
- Expecting extra fields to be rejected. Because additionalProperties is not written, keys the schema does not define are valid, and a misspelt field name passes unnoticed.
- Leaving a field that was null in a one-record sample as it is. "type": "null" accepts nothing but null; add the field's real type, for example ["string", "null"].
- Expecting values written like 1.0 to come out as integer. The tool writes number as soon as it sees a decimal point. In JSON Schema a number with a zero fractional part also counts as an integer, so if the field really holds whole numbers you can change the type to integer by hand.
- Expecting an item schema from an empty array. For "tags": [] only "type": "array" is written; the element type has to be added by hand.
📘 Generate a JSON Schema from JSON: type, required and format Rules →
Sources
- JSON Schema: A Media Type for Describing JSON Documents (Core, draft 2020-12) ↗
- JSON Schema Validation: A Vocabulary for Structural Validation of JSON (draft 2020-12; type, required, format) ↗
- IETF RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format ↗
- IETF RFC 3339: Date and Time on the Internet: Timestamps (the date-time and date formats) ↗
Key terms
Frequently Asked Questions
+JSON Schema Generator — how is it calculated?
Infers a JSON Schema (draft 2020-12) from a sample JSON document: types, properties, required for keys present in every sample, a merged schema for array items (anyOf for mixed types), integer vs. number, and null. A string only gets a format when it matches strictly: date-time, date, email, uri or uuid.
+Which values are required?
JSON.
+Is my data stored?
No. All calculations run in your browser; the values you enter are never sent to or stored on a server. If you press “Save”, the calculation stays only in your own browser and you can delete it at any time.
+Is it free?
Yes, all tools are free and require no sign-up.
Similar tools
Popular Tools
Free Calculators in One Place
Tax, finance, health, math and more — 500+ tools, all in one place.